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

position(): return portable type ssize_t instead of non-portable type long

IMHO position can return negative values, hence, we need to us
signed ssize_t rather than unsigned size_t.

Ceterum censeo type long MUST NOT be used as it is everything but portable;
for instance, on our beloved Windows platforms, long is always 32-bit,
even on 64-bit systems.


diffs (41 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
@@ -2963,7 +2963,7 @@ str pinRef;
 int pivotDisjunctiveProp;
 int pivotProp;
 str plusRef;
-long position(Client cntxt);
+ssize_t position(Client cntxt);
 str postludeRef;
 str pqueueRef;
 str preludeRef;
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -370,11 +370,11 @@ lastline(Client cntxt)
        return s;
 }
 
-long
+ssize_t
 position(Client cntxt)
 {
        str s = lastline(cntxt);
-       return (long) (CURRENT(cntxt) - s);
+       return (ssize_t) (CURRENT(cntxt) - s);
 }
 
 /*
diff --git a/monetdb5/mal/mal_parser.h b/monetdb5/mal/mal_parser.h
--- a/monetdb5/mal/mal_parser.h
+++ b/monetdb5/mal/mal_parser.h
@@ -44,7 +44,7 @@ mal_export str operatorCopy(Client cntxt
 mal_export int MALkeyword(Client cntxt, str kw, int length);
 mal_export int MALlookahead(Client cntxt, str kw, int length);
 mal_export str lastline(Client cntxt);
-mal_export long position(Client cntxt);
+mal_export ssize_t position(Client cntxt);
 
 #endif /* _MAL_PARSER_H */
 
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to