diff options
author | Luke Leighton <lkcl@samba.org> | 1998-11-23 21:51:05 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-11-23 21:51:05 +0000 |
commit | 4cee58780cb15fe5889b9dd0dc34459512d75062 (patch) | |
tree | 07e0db236cfdb786458451b879333bc1d687cf3c /source3/lib/util.c | |
parent | 735926877bb8333a9e862657ea89001bea376b9f (diff) | |
download | samba-4cee58780cb15fe5889b9dd0dc34459512d75062.tar.gz samba-4cee58780cb15fe5889b9dd0dc34459512d75062.tar.bz2 samba-4cee58780cb15fe5889b9dd0dc34459512d75062.zip |
unix instance of group database API
(This used to be commit e76f593b3572ac881f1aa1fb3326d8b7169b0078)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r-- | source3/lib/util.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 7247e95c64..ad5dbcf106 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -189,6 +189,18 @@ char *Atoic(char *p, int *n, char *c) return p; } +int* add_num_to_list(uint32 **num, int *count, int val) +{ + (*num) = Realloc((*num), ((*count)+1) * sizeof(uint32)); + if ((*num) == NULL) + { + return NULL; + } + (*num)[(*count)] = val; + (*count)++; + + return (*num); +} /************************************************************************* reads a list of numbers *************************************************************************/ @@ -206,13 +218,10 @@ char *get_numlist(char *p, uint32 **num, int *count) while ((p = Atoic(p, &val, ":,")) != NULL && (*p) != ':') { - (*num) = Realloc((*num), ((*count)+1) * sizeof(uint32)); - if ((*num) == NULL) + if (add_num_to_list(num, count, val) == NULL) { return NULL; } - (*num)[(*count)] = val; - (*count)++; p++; } |