Merge pull request #1818 from citusdata/remove-strtoull-ifdef

Remove an ifdef surrounding strtoull
pull/1806/head
Marco Slot 2017-12-21 16:47:34 +03:00 committed by GitHub
commit 6862cd066e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 8 deletions

View File

@ -839,7 +839,7 @@ WorkerShardStats(ShardPlacement *placement, Oid relationId, char *shardName,
} }
errno = 0; errno = 0;
tableSize = strtoull(tableSizeString, &tableSizeStringEnd, 0); tableSize = pg_strtouint64(tableSizeString, &tableSizeStringEnd, 0);
if (errno != 0 || (*tableSizeStringEnd) != '\0') if (errno != 0 || (*tableSizeStringEnd) != '\0')
{ {
PQclear(queryResult); PQclear(queryResult);

View File

@ -19,6 +19,7 @@
#include "distributed/multi_server_executor.h" #include "distributed/multi_server_executor.h"
#include "nodes/parsenodes.h" #include "nodes/parsenodes.h"
#include "nodes/readfuncs.h" #include "nodes/readfuncs.h"
#include "utils/builtins.h"
/* /*
@ -158,7 +159,7 @@ CitusSetTag(Node *node, int tag)
#define atooid(x) ((Oid) strtoul((x), NULL, 10)) #define atooid(x) ((Oid) strtoul((x), NULL, 10))
/* XXX: Citus */ /* XXX: Citus */
#define atoull(x) ((uint64) strtoull((x), NULL, 10)) #define atoull(x) ((uint64) pg_strtouint64((x), NULL, 10))
#define strtobool(x) ((*(x) == 't') ? true : false) #define strtobool(x) ((*(x) == 't') ? true : false)

View File

@ -784,19 +784,14 @@ ExtractShardId(const char *tableName)
} }
shardIdString++; shardIdString++;
#ifdef HAVE_STRTOULL
errno = 0; errno = 0;
shardId = strtoull(shardIdString, &shardIdStringEnd, 0); shardId = pg_strtouint64(shardIdString, &shardIdStringEnd, 0);
if (errno != 0 || (*shardIdStringEnd != '\0')) if (errno != 0 || (*shardIdStringEnd != '\0'))
{ {
ereport(ERROR, (errmsg("could not extract shardId from table name \"%s\"", ereport(ERROR, (errmsg("could not extract shardId from table name \"%s\"",
tableName))); tableName)));
} }
#else
ereport(ERROR, (errmsg("could not extract shardId from table name"),
errhint("Your platform does not support strtoull()")));
#endif
return shardId; return shardId;
} }