Changeset: af120bf9503d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af120bf9503d
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/modules/mal/sample.c
        monetdb5/modules/mal/sample.h
Branch: Jan2014
Log Message:

Fix pointer usage.
Normally a change to the exports output is not allowed in a stable
branch, but this is an exception.  We now declare the arguments the
way they are used de facto.  There is no change in the ABI, it is just
made explicit that the arguments are wrd/dbl pointers.


diffs (91 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2049,9 +2049,9 @@ str SABmarchConnection(int *ret, str *ho
 str SABmarchScenario(int *ret, str *lang);
 str SABprelude(int *ret);
 str SABretreatScenario(int *ret, str *lang);
-str SAMPLEsubuniform(bat *r, bat *b, ptr s);
-str SAMPLEuniform(bat *r, bat *b, ptr s);
-str SAMPLEuniform_dbl(bat *r, bat *b, ptr p);
+str SAMPLEsubuniform(bat *r, bat *b, wrd *s);
+str SAMPLEuniform(bat *r, bat *b, wrd *s);
+str SAMPLEuniform_dbl(bat *r, bat *b, dbl *p);
 str SEMAcreate(monet_sema *res, int *init);
 str SEMAdestroy(int *res, monet_sema *s);
 str SEMAdown(int *res, monet_sema *s);
diff --git a/monetdb5/modules/mal/sample.c b/monetdb5/modules/mal/sample.c
--- a/monetdb5/modules/mal/sample.c
+++ b/monetdb5/modules/mal/sample.c
@@ -79,13 +79,13 @@
  */
 
 str
-SAMPLEuniform(bat *r, bat *b, ptr s) {
+SAMPLEuniform(bat *r, bat *b, wrd *s) {
        BAT *br, *bb;
 
        if ((bb = BATdescriptor(*b)) == NULL) {
                throw(MAL, "sample.uniform", INTERNAL_BAT_ACCESS);
        }
-       br = BATsample(bb,*(BUN *)s);
+       br = BATsample(bb, (BUN) *s);
        if (br == NULL)
                throw(MAL, "sample.uniform", OPERATION_FAILED);
 
@@ -96,13 +96,13 @@ SAMPLEuniform(bat *r, bat *b, ptr s) {
 }
 
 str
-SAMPLEsubuniform(bat *r, bat *b, ptr s) {
+SAMPLEsubuniform(bat *r, bat *b, wrd *s) {
        BAT *br, *bb;
 
        if ((bb = BATdescriptor(*b)) == NULL) {
                throw(MAL, "sample.subuniform", INTERNAL_BAT_ACCESS);
        }
-       br = BATsample_(bb,*(BUN *)s);
+       br = BATsample_(bb, (BUN) *s);
        if (br == NULL)
                throw(MAL, "sample.subuniform", OPERATION_FAILED);
 
@@ -113,9 +113,9 @@ SAMPLEsubuniform(bat *r, bat *b, ptr s) 
 }
 
 str
-SAMPLEuniform_dbl(bat *r, bat *b, ptr p) {
+SAMPLEuniform_dbl(bat *r, bat *b, dbl *p) {
        BAT *bb;
-       double pr = *(double *)p;
+       double pr = *p;
        wrd s;
 
        if ( pr < 0.0 || pr > 1.0 ) {
@@ -123,7 +123,7 @@ SAMPLEuniform_dbl(bat *r, bat *b, ptr p)
                                " p should be between 0 and 1.0" );
        } else if (pr == 0) {/* special case */
                s = 0;
-               return SAMPLEuniform(r, b, (ptr)&s);
+               return SAMPLEuniform(r, b, &s);
        }
        if ((bb = BATdescriptor(*b)) == NULL) {
                throw(MAL, "sample.uniform", INTERNAL_BAT_ACCESS);
diff --git a/monetdb5/modules/mal/sample.h b/monetdb5/modules/mal/sample.h
--- a/monetdb5/modules/mal/sample.h
+++ b/monetdb5/modules/mal/sample.h
@@ -39,12 +39,12 @@
 #endif
 
 sample_export str
-SAMPLEuniform(bat *r, bat *b, ptr s);
+SAMPLEuniform(bat *r, bat *b, wrd *s);
 
 sample_export str
-SAMPLEsubuniform(bat *r, bat *b, ptr s);
+SAMPLEsubuniform(bat *r, bat *b, wrd *s);
 
 sample_export str
-SAMPLEuniform_dbl(bat *r, bat *b, ptr p);
+SAMPLEuniform_dbl(bat *r, bat *b, dbl *p);
 
 #endif
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to