| 895 | } |
| 896 | |
| 897 | int poptSaveString(const char *** argvp, |
| 898 | UNUSED(unsigned int argInfo), const char * val) |
| 899 | { |
| 900 | int argc = 0; |
| 901 | |
| 902 | if (argvp == NULL || val == NULL) |
| 903 | return POPT_ERROR_NULLARG; |
| 904 | |
| 905 | /* XXX likely needs an upper bound on argc. */ |
| 906 | if (*argvp != NULL) |
| 907 | while ((*argvp)[argc] != NULL) |
| 908 | argc++; |
| 909 | |
| 910 | if ((*argvp = xrealloc(*argvp, (argc + 1 + 1) * sizeof(**argvp))) != NULL) { |
| 911 | (*argvp)[argc++] = xstrdup(val); |
| 912 | (*argvp)[argc ] = NULL; |
| 913 | } |
| 914 | return 0; |
| 915 | } |
| 916 | |
| 917 | static long long poptRandomValue(long long limit) |
| 918 | { |