summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2010-08-23 17:55:09 +0000
committerMichael Jennings <mej@kainx.org>2010-08-23 17:55:09 +0000
commit8b96666c7c7dd4fc1b52fdb4b55bbc15ca0c071c (patch)
treec99e7812575034fd8d3e4c09dddc077437980b34
parente14093a9f933fef1826d4036bf9991387020405d (diff)
Revert coccinelle changes.
Using !! instead of != NULL results in significantly and unacceptably less readable code, and I refuse to accept those changes. Unfortunately, since they were all done at once, I have to revert the whole thing. Oh well. :( SVN revision: 51583
-rw-r--r--src/conf.c40
-rw-r--r--src/mem.c24
-rw-r--r--src/msgs.c8
-rw-r--r--src/options.c14
-rw-r--r--src/snprintf.c4
-rw-r--r--src/socket.c22
-rw-r--r--src/str.c3
-rw-r--r--src/strings.c20
-rw-r--r--src/tok.c2
-rw-r--r--src/url.c24
-rw-r--r--src/ustr.c3
-rw-r--r--test/test.c46
12 files changed, 106 insertions, 104 deletions
diff --git a/src/conf.c b/src/conf.c
index cd4ff2c..1d2e74b 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -242,7 +242,7 @@ spifconf_put_var(spif_charptr_t var, spif_charptr_t val)
242{ 242{
243 spifconf_var_t *v, *loc = NULL, *tmp; 243 spifconf_var_t *v, *loc = NULL, *tmp;
244 244
245 ASSERT(!!var); 245 ASSERT(var != NULL);
246 D_CONF(("var == \"%s\", val == \"%s\"\n", var, val)); 246 D_CONF(("var == \"%s\", val == \"%s\"\n", var, val));
247 247
248 for (v = spifconf_vars; v; loc = v, v = v->next) { 248 for (v = spifconf_vars; v; loc = v, v = v->next) {
@@ -277,7 +277,7 @@ spifconf_put_var(spif_charptr_t var, spif_charptr_t val)
277 ((loc) ? (loc->var) : ((spif_charptr_t) "-beginning-")), 277 ((loc) ? (loc->var) : ((spif_charptr_t) "-beginning-")),
278 ((v) ? (v->var) : ((spif_charptr_t) "-end-")))); 278 ((v) ? (v->var) : ((spif_charptr_t) "-end-"))));
279 tmp = spifconf_new_var(); 279 tmp = spifconf_new_var();
280 if (!loc) { 280 if (loc == NULL) {
281 tmp->next = spifconf_vars; 281 tmp->next = spifconf_vars;
282 spifconf_vars = tmp; 282 spifconf_vars = tmp;
283 } else { 283 } else {
@@ -338,7 +338,7 @@ builtin_exec(spif_charptr_t param)
338 strcat((char *) Command, " >"); 338 strcat((char *) Command, " >");
339 strcat((char *) Command, (char *) OutFile); 339 strcat((char *) Command, (char *) OutFile);
340 system((char *) Command); 340 system((char *) Command);
341 if ((fp = fdopen(fd, "rb"))) { 341 if ((fp = fdopen(fd, "rb")) != NULL) {
342 fseek(fp, 0, SEEK_END); 342 fseek(fp, 0, SEEK_END);
343 fsize = ftell(fp); 343 fsize = ftell(fp);
344 rewind(fp); 344 rewind(fp);
@@ -437,7 +437,7 @@ builtin_dirscan(spif_charptr_t param)
437 *buff = 0; 437 *buff = 0;
438 n = CONFIG_BUFF; 438 n = CONFIG_BUFF;
439 439
440 for (i = 0; (dp = readdir(dirp));) { 440 for (i = 0; (dp = readdir(dirp)) != NULL;) {
441 spif_char_t fullname[PATH_MAX]; 441 spif_char_t fullname[PATH_MAX];
442 442
443 snprintf((char *) fullname, sizeof(fullname), "%s/%s", dir, dp->d_name); 443 snprintf((char *) fullname, sizeof(fullname), "%s/%s", dir, dp->d_name);
@@ -498,7 +498,7 @@ spifconf_shell_expand(spif_charptr_t s)
498 const spif_uint32_t max = CONFIG_BUFF - 1; 498 const spif_uint32_t max = CONFIG_BUFF - 1;
499 spif_charptr_t Command, Output, EnvVar; 499 spif_charptr_t Command, Output, EnvVar;
500 500
501 ASSERT_RVAL(!!s, (spif_charptr_t) NULL); 501 ASSERT_RVAL(s != NULL, (spif_charptr_t) NULL);
502 502
503#if 0 503#if 0
504 newbuff = (spif_charptr_t) MALLOC(CONFIG_BUFF); 504 newbuff = (spif_charptr_t) MALLOC(CONFIG_BUFF);
@@ -557,7 +557,7 @@ spifconf_shell_expand(spif_charptr_t s)
557 break; 557 break;
558 case '%': 558 case '%':
559 D_CONF(("%% detected.\n")); 559 D_CONF(("%% detected.\n"));
560 for (k = 0, pbuff++; builtins[k].name; k++) { 560 for (k = 0, pbuff++; builtins[k].name != NULL; k++) {
561 D_PARSE(("Checking for function %%%s, pbuff == \"%s\"\n", builtins[k].name, pbuff)); 561 D_PARSE(("Checking for function %%%s, pbuff == \"%s\"\n", builtins[k].name, pbuff));
562 l = strlen((char *) builtins[k].name); 562 l = strlen((char *) builtins[k].name);
563 if (!strncasecmp((char *) builtins[k].name, (char *) pbuff, l) 563 if (!strncasecmp((char *) builtins[k].name, (char *) pbuff, l)
@@ -567,7 +567,7 @@ spifconf_shell_expand(spif_charptr_t s)
567 break; 567 break;
568 } 568 }
569 } 569 }
570 if (!builtins[k].name) { 570 if (builtins[k].name == NULL) {
571 newbuff[j] = *pbuff; 571 newbuff[j] = *pbuff;
572 } else { 572 } else {
573 D_CONF(("Call to built-in function %s detected.\n", builtins[k].name)); 573 D_CONF(("Call to built-in function %s detected.\n", builtins[k].name));
@@ -729,7 +729,7 @@ spifconf_find_file(const spif_charptr_t file, const spif_charptr_t dir, const sp
729 spif_int32_t len, maxpathlen; 729 spif_int32_t len, maxpathlen;
730 struct stat fst; 730 struct stat fst;
731 731
732 REQUIRE_RVAL(!!file, NULL); 732 REQUIRE_RVAL(file != NULL, NULL);
733 733
734 getcwd((char *) name, PATH_MAX); 734 getcwd((char *) name, PATH_MAX);
735 D_CONF(("spifconf_find_file(\"%s\", \"%s\", \"%s\") called from directory \"%s\".\n", 735 D_CONF(("spifconf_find_file(\"%s\", \"%s\", \"%s\") called from directory \"%s\".\n",
@@ -765,11 +765,11 @@ spifconf_find_file(const spif_charptr_t file, const spif_charptr_t dir, const sp
765 return ((spif_charptr_t) NULL); 765 return ((spif_charptr_t) NULL);
766 } 766 }
767 767
768 for (path = pathlist; path && *path != '\0'; path = p) { 768 for (path = pathlist; path != NULL && *path != '\0'; path = p) {
769 short n; 769 short n;
770 770
771 /* Calculate the length of the next directory in the path */ 771 /* Calculate the length of the next directory in the path */
772 if ((p = (spif_charptr_t)strchr((char *)path, ':'))) { 772 if ((p = (spif_charptr_t) strchr((char *) path, ':')) != NULL) {
773 n = p++ - path; 773 n = p++ - path;
774 } else { 774 } else {
775 n = strlen((char *) path); 775 n = strlen((char *) path);
@@ -808,7 +808,7 @@ spifconf_open_file(spif_charptr_t name)
808 spif_charptr_t begin_ptr, end_ptr; 808 spif_charptr_t begin_ptr, end_ptr;
809 spif_stridx_t testlen; 809 spif_stridx_t testlen;
810 810
811 ASSERT_RVAL(!!name, NULL); 811 ASSERT_RVAL(name != NULL, NULL);
812 812
813 snprintf((char *) test, sizeof(test), "<%s-", libast_program_name); 813 snprintf((char *) test, sizeof(test), "<%s-", libast_program_name);
814 testlen = (spif_stridx_t) strlen((char *) test); 814 testlen = (spif_stridx_t) strlen((char *) test);
@@ -816,7 +816,7 @@ spifconf_open_file(spif_charptr_t name)
816 /* Read first line from config file. Using spif_str_new_from_fp() would read the 816 /* Read first line from config file. Using spif_str_new_from_fp() would read the
817 * whole file, so we don't do that here. */ 817 * whole file, so we don't do that here. */
818 fp = fopen((char *) name, "rt"); 818 fp = fopen((char *) name, "rt");
819 REQUIRE_RVAL(!!fp, NULL); 819 REQUIRE_RVAL(fp != NULL, NULL);
820 fgets((char *) buff, 256, fp); 820 fgets((char *) buff, 256, fp);
821 ver_str = spif_str_new_from_ptr(buff); 821 ver_str = spif_str_new_from_ptr(buff);
822 822
@@ -857,12 +857,12 @@ spifconf_parse_line(FILE * fp, spif_charptr_t buff)
857 unsigned char id; 857 unsigned char id;
858 void *state = NULL; 858 void *state = NULL;
859 859
860 ASSERT(!!buff); 860 ASSERT(buff != NULL);
861 861
862 if (!(*buff) || *buff == '\n' || *buff == '#' || *buff == '<') { 862 if (!(*buff) || *buff == '\n' || *buff == '#' || *buff == '<') {
863 SPIFCONF_PARSE_RET(); 863 SPIFCONF_PARSE_RET();
864 } 864 }
865 if (!fp) { 865 if (fp == NULL) {
866 file_push(NULL, (spif_charptr_t) "<argv>", NULL, 0, 0); 866 file_push(NULL, (spif_charptr_t) "<argv>", NULL, 0, 0);
867 ctx_begin(1); 867 ctx_begin(1);
868 buff = spiftool_get_pword(2, buff); 868 buff = spiftool_get_pword(2, buff);
@@ -884,7 +884,7 @@ spifconf_parse_line(FILE * fp, spif_charptr_t buff)
884 884
885 spifconf_shell_expand((spif_charptr_t) buff); 885 spifconf_shell_expand((spif_charptr_t) buff);
886 path = spiftool_get_word(2, buff + 1); 886 path = spiftool_get_word(2, buff + 1);
887 if (!(fp = spifconf_open_file(path))) { 887 if ((fp = spifconf_open_file(path)) == NULL) {
888 libast_print_error("Parsing file %s, line %lu: Unable to locate %%included config file %s (%s), continuing\n", file_peek_path(), 888 libast_print_error("Parsing file %s, line %lu: Unable to locate %%included config file %s (%s), continuing\n", file_peek_path(),
889 file_peek_line(), path, strerror(errno)); 889 file_peek_line(), path, strerror(errno));
890 } else { 890 } else {
@@ -906,7 +906,7 @@ spifconf_parse_line(FILE * fp, spif_charptr_t buff)
906 spiftool_get_pword(2, buff), file_peek_path(), fname); 906 spiftool_get_pword(2, buff), file_peek_path(), fname);
907 system((char *) cmd); 907 system((char *) cmd);
908 fp = fdopen(fd, "rt"); 908 fp = fdopen(fd, "rt");
909 if (fp) { 909 if (fp != NULL) {
910 fclose(file_peek_fp()); 910 fclose(file_peek_fp());
911 file_poke_fp(fp); 911 file_poke_fp(fp);
912 file_poke_preproc(1); 912 file_poke_preproc(1);
@@ -953,12 +953,12 @@ spifconf_parse(spif_charptr_t conf_name, const spif_charptr_t dir, const spif_ch
953 spif_charptr_t name = NULL, p = (spif_charptr_t) "."; 953 spif_charptr_t name = NULL, p = (spif_charptr_t) ".";
954 spif_char_t buff[CONFIG_BUFF], orig_dir[PATH_MAX]; 954 spif_char_t buff[CONFIG_BUFF], orig_dir[PATH_MAX];
955 955
956 REQUIRE_RVAL(!!conf_name, 0); 956 REQUIRE_RVAL(conf_name != NULL, 0);
957 957
958 *orig_dir = 0; 958 *orig_dir = 0;
959 if (path) { 959 if (path) {
960 if ((name = spifconf_find_file(conf_name, dir, path))) { 960 if ((name = spifconf_find_file(conf_name, dir, path)) != NULL) {
961 if ((p = (spif_charptr_t)strrchr((char *)name, '/'))) { 961 if ((p = (spif_charptr_t) strrchr((char *) name, '/')) != NULL) {
962 getcwd((char *) orig_dir, PATH_MAX); 962 getcwd((char *) orig_dir, PATH_MAX);
963 *p = 0; 963 *p = 0;
964 p = name; 964 p = name;
@@ -970,7 +970,7 @@ spifconf_parse(spif_charptr_t conf_name, const spif_charptr_t dir, const spif_ch
970 return NULL; 970 return NULL;
971 } 971 }
972 } 972 }
973 if (!(fp = spifconf_open_file(conf_name))) { 973 if ((fp = spifconf_open_file(conf_name)) == NULL) {
974 return NULL; 974 return NULL;
975 } 975 }
976 /* Line count starts at 1 because spifconf_open_file() parses the first line. */ 976 /* Line count starts at 1 because spifconf_open_file() parses the first line. */
diff --git a/src/mem.c b/src/mem.c
index e8e5d3c..2b4a877 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -146,9 +146,9 @@ memrec_add_var(memrec_t *memrec, const spif_charptr_t filename, unsigned long li
146{ 146{
147 register ptr_t *p; 147 register ptr_t *p;
148 148
149 ASSERT(!!memrec); 149 ASSERT(memrec != NULL);
150 memrec->cnt++; 150 memrec->cnt++;
151 if (!(memrec->ptrs = (ptr_t *)realloc(memrec->ptrs, sizeof(ptr_t) * memrec->cnt))) { 151 if ((memrec->ptrs = (ptr_t *) realloc(memrec->ptrs, sizeof(ptr_t) * memrec->cnt)) == NULL) {
152 D_MEM(("Unable to reallocate pointer list -- %s\n", strerror(errno))); 152 D_MEM(("Unable to reallocate pointer list -- %s\n", strerror(errno)));
153 } 153 }
154 p = memrec->ptrs + memrec->cnt - 1; 154 p = memrec->ptrs + memrec->cnt - 1;
@@ -181,8 +181,8 @@ memrec_find_var(memrec_t *memrec, const void *ptr)
181 register ptr_t *p; 181 register ptr_t *p;
182 register unsigned long i; 182 register unsigned long i;
183 183
184 ASSERT_RVAL(!!memrec, NULL); 184 ASSERT_RVAL(memrec != NULL, NULL);
185 REQUIRE_RVAL(!!ptr, NULL); 185 REQUIRE_RVAL(ptr != NULL, NULL);
186 186
187 for (i = 0, p = memrec->ptrs; i < memrec->cnt; i++, p++) { 187 for (i = 0, p = memrec->ptrs; i < memrec->cnt; i++, p++) {
188 if (p->ptr == ptr) { 188 if (p->ptr == ptr) {
@@ -215,12 +215,12 @@ memrec_rem_var(memrec_t *memrec, const spif_charptr_t var, const spif_charptr_t
215{ 215{
216 register ptr_t *p; 216 register ptr_t *p;
217 217
218 ASSERT(!!memrec); 218 ASSERT(memrec != NULL);
219 USE_VAR(var); 219 USE_VAR(var);
220 USE_VAR(filename); 220 USE_VAR(filename);
221 USE_VAR(line); 221 USE_VAR(line);
222 222
223 if (!(p = memrec_find_var(memrec, ptr))) { 223 if ((p = memrec_find_var(memrec, ptr)) == NULL) {
224 D_MEM(("ERROR: File %s, line %d attempted to free variable %s (%10p) which was not allocated with MALLOC/REALLOC\n", 224 D_MEM(("ERROR: File %s, line %d attempted to free variable %s (%10p) which was not allocated with MALLOC/REALLOC\n",
225 filename, line, var, ptr)); 225 filename, line, var, ptr));
226 return; 226 return;
@@ -256,10 +256,10 @@ memrec_chg_var(memrec_t *memrec, const spif_charptr_t var, const spif_charptr_t
256{ 256{
257 register ptr_t *p; 257 register ptr_t *p;
258 258
259 ASSERT(!!memrec); 259 ASSERT(memrec != NULL);
260 USE_VAR(var); 260 USE_VAR(var);
261 261
262 if (!(p = memrec_find_var(memrec, oldp))) { 262 if ((p = memrec_find_var(memrec, oldp)) == NULL) {
263 D_MEM(("ERROR: File %s, line %d attempted to realloc variable %s (%10p) which was not allocated with MALLOC/REALLOC\n", filename, 263 D_MEM(("ERROR: File %s, line %d attempted to realloc variable %s (%10p) which was not allocated with MALLOC/REALLOC\n", filename,
264 line, var, oldp)); 264 line, var, oldp));
265 return; 265 return;
@@ -292,7 +292,7 @@ memrec_dump_pointers(memrec_t *memrec)
292 unsigned long len; 292 unsigned long len;
293 spif_char_t buff[9]; 293 spif_char_t buff[9];
294 294
295 ASSERT(!!memrec); 295 ASSERT(memrec != NULL);
296 fprintf(LIBAST_DEBUG_FD, "PTR: %lu pointers stored.\n", (unsigned long) memrec->cnt); 296 fprintf(LIBAST_DEBUG_FD, "PTR: %lu pointers stored.\n", (unsigned long) memrec->cnt);
297 fprintf(LIBAST_DEBUG_FD, 297 fprintf(LIBAST_DEBUG_FD,
298 "PTR: Pointer | Filename | Line | Address | Size | Offset | 00 01 02 03 04 05 06 07 | ASCII \n"); 298 "PTR: Pointer | Filename | Line | Address | Size | Offset | 00 01 02 03 04 05 06 07 | ASCII \n");
@@ -375,7 +375,7 @@ memrec_dump_resources(memrec_t *memrec)
375 unsigned long i, total; 375 unsigned long i, total;
376 unsigned long len; 376 unsigned long len;
377 377
378 ASSERT(!!memrec); 378 ASSERT(memrec != NULL);
379 len = memrec->cnt; 379 len = memrec->cnt;
380 fprintf(LIBAST_DEBUG_FD, "RES: %lu resources stored.\n", 380 fprintf(LIBAST_DEBUG_FD, "RES: %lu resources stored.\n",
381 (unsigned long) memrec->cnt); 381 (unsigned long) memrec->cnt);
@@ -471,7 +471,7 @@ spifmem_realloc(const spif_charptr_t var, const spif_charptr_t filename, unsigne
471#endif 471#endif
472 472
473 D_MEM(("Variable %s (%10p -> %lu) at %s:%lu\n", var, ptr, (unsigned long) size, NONULL(filename), line)); 473 D_MEM(("Variable %s (%10p -> %lu) at %s:%lu\n", var, ptr, (unsigned long) size, NONULL(filename), line));
474 if (!ptr) { 474 if (ptr == NULL) {
475 temp = (void *) spifmem_malloc(filename, line, size); 475 temp = (void *) spifmem_malloc(filename, line, size);
476 } else if (size == 0) { 476 } else if (size == 0) {
477 spifmem_free(var, filename, line, ptr); 477 spifmem_free(var, filename, line, ptr);
@@ -878,7 +878,7 @@ spiftool_free_array(void *list, size_t count)
878 register size_t i; 878 register size_t i;
879 void **l = (void **) list; 879 void **l = (void **) list;
880 880
881 REQUIRE(!!list); 881 REQUIRE(list != NULL);
882 882
883 if (count == 0) { 883 if (count == 0) {
884 count = (size_t) (-1); 884 count = (size_t) (-1);
diff --git a/src/msgs.c b/src/msgs.c
index 7d54f9a..5012e3d 100644
--- a/src/msgs.c
+++ b/src/msgs.c
@@ -165,7 +165,7 @@ libast_dprintf(const char *format, ...)
165 165
166 ASSERT_RVAL(!SPIF_PTR_ISNULL(format), (int) -1); 166 ASSERT_RVAL(!SPIF_PTR_ISNULL(format), (int) -1);
167 REQUIRE_RVAL(!silent, 0); 167 REQUIRE_RVAL(!silent, 0);
168 REQUIRE_RVAL(!!libast_program_name, 0); 168 REQUIRE_RVAL(libast_program_name != NULL, 0);
169 va_start(args, format); 169 va_start(args, format);
170 n = vfprintf(LIBAST_DEBUG_FD, format, args); 170 n = vfprintf(LIBAST_DEBUG_FD, format, args);
171 va_end(args); 171 va_end(args);
@@ -194,7 +194,7 @@ libast_print_error(const char *fmt, ...)
194 194
195 ASSERT(!SPIF_PTR_ISNULL(fmt)); 195 ASSERT(!SPIF_PTR_ISNULL(fmt));
196 REQUIRE(!silent); 196 REQUIRE(!silent);
197 REQUIRE(!!libast_program_name); 197 REQUIRE(libast_program_name != NULL);
198 va_start(arg_ptr, fmt); 198 va_start(arg_ptr, fmt);
199 fprintf(stderr, "%s: Error: ", libast_program_name); 199 fprintf(stderr, "%s: Error: ", libast_program_name);
200 vfprintf(stderr, fmt, arg_ptr); 200 vfprintf(stderr, fmt, arg_ptr);
@@ -222,7 +222,7 @@ libast_print_warning(const char *fmt, ...)
222 222
223 ASSERT(!SPIF_PTR_ISNULL(fmt)); 223 ASSERT(!SPIF_PTR_ISNULL(fmt));
224 REQUIRE(!silent); 224 REQUIRE(!silent);
225 REQUIRE(!!libast_program_name); 225 REQUIRE(libast_program_name != NULL);
226 va_start(arg_ptr, fmt); 226 va_start(arg_ptr, fmt);
227 fprintf(stderr, "%s: Warning: ", libast_program_name); 227 fprintf(stderr, "%s: Warning: ", libast_program_name);
228 vfprintf(stderr, fmt, arg_ptr); 228 vfprintf(stderr, fmt, arg_ptr);
@@ -249,7 +249,7 @@ libast_fatal_error(const char *fmt, ...)
249 va_list arg_ptr; 249 va_list arg_ptr;
250 250
251 ASSERT(!SPIF_PTR_ISNULL(fmt)); 251 ASSERT(!SPIF_PTR_ISNULL(fmt));
252 if ((!silent) && (libast_program_name)) { 252 if ((!silent) && (libast_program_name != NULL)) {
253 va_start(arg_ptr, fmt); 253 va_start(arg_ptr, fmt);
254 fprintf(stderr, "%s: FATAL: ", libast_program_name); 254 fprintf(stderr, "%s: FATAL: ", libast_program_name);
255 vfprintf(stderr, fmt, arg_ptr); 255 vfprintf(stderr, fmt, arg_ptr);
diff --git a/src/options.c b/src/options.c
index 80ef34d..afdd123 100644
--- a/src/options.c
+++ b/src/options.c
@@ -257,7 +257,7 @@ find_value_long(spif_charptr_t arg, spif_charptr_t next_arg, spif_charptr_t hase
257{ 257{
258 spif_charptr_t val_ptr; 258 spif_charptr_t val_ptr;
259 259
260 if ((val_ptr = SPIF_CHARPTR(strchr((char *)arg, '=')))) { 260 if ((val_ptr = SPIF_CHARPTR(strchr((char *) arg, '='))) != NULL) {
261 val_ptr++; 261 val_ptr++;
262 *hasequal = 1; 262 *hasequal = 1;
263 } else { 263 } else {
@@ -291,7 +291,7 @@ find_value_short(spif_charptr_t arg, spif_charptr_t next_arg)
291 291
292 if (arg[1]) { 292 if (arg[1]) {
293 val_ptr = arg + 1; 293 val_ptr = arg + 1;
294 } else if (next_arg) { 294 } else if (next_arg != NULL) {
295 val_ptr = next_arg; 295 val_ptr = next_arg;
296 } 296 }
297 D_OPTIONS(("val_ptr == %10.8p \"%s\"\n", val_ptr, NONULL(val_ptr))); 297 D_OPTIONS(("val_ptr == %10.8p \"%s\"\n", val_ptr, NONULL(val_ptr)));
@@ -335,7 +335,7 @@ is_boolean_value(spif_charptr_t val_ptr)
335static spif_bool_t 335static spif_bool_t
336is_valid_option(spif_charptr_t opt) 336is_valid_option(spif_charptr_t opt)
337{ 337{
338 REQUIRE_RVAL(!!opt, FALSE); 338 REQUIRE_RVAL(opt != NULL, FALSE);
339 339
340 if (*opt != '-') { 340 if (*opt != '-') {
341 return FALSE; 341 return FALSE;
@@ -527,7 +527,7 @@ spifopt_parse(int argc, char *argv[])
527 spif_charptr_t opt; 527 spif_charptr_t opt;
528 528
529 REQUIRE(argc > 1); 529 REQUIRE(argc > 1);
530 REQUIRE(!!argv); 530 REQUIRE(argv != NULL);
531 531
532 /* Process each command line arg one-by-one. */ 532 /* Process each command line arg one-by-one. */
533 for (i = 1, opt = SPIF_CHARPTR(argv[1]); i < argc; ) { 533 for (i = 1, opt = SPIF_CHARPTR(argv[1]); i < argc; ) {
@@ -608,7 +608,7 @@ spifopt_parse(int argc, char *argv[])
608 608
609 /* Make sure that options which require a parameter have them. */ 609 /* Make sure that options which require a parameter have them. */
610 if (SPIFOPT_OPT_NEEDS_VALUE(j)) { 610 if (SPIFOPT_OPT_NEEDS_VALUE(j)) {
611 if (!val_ptr) { 611 if (val_ptr == NULL) {
612 if (islong) { 612 if (islong) {
613 libast_print_error("long option --%s requires a%s value\n", SPIFOPT_OPT_LONG(j), 613 libast_print_error("long option --%s requires a%s value\n", SPIFOPT_OPT_LONG(j),
614 (SPIFOPT_OPT_IS_INTEGER(j) 614 (SPIFOPT_OPT_IS_INTEGER(j)
@@ -632,10 +632,10 @@ spifopt_parse(int argc, char *argv[])
632 continue; 632 continue;
633 } 633 }
634 /* Also make sure we know what to do with the value. */ 634 /* Also make sure we know what to do with the value. */
635 if (!SPIFOPT_OPT_VALUE(j)) { 635 if (SPIFOPT_OPT_VALUE(j) == NULL) {
636 NEXT_LOOP(); 636 NEXT_LOOP();
637 } 637 }
638 } else if (SPIFOPT_OPT_IS_ABSTRACT(j) && !SPIFOPT_OPT_VALUE(j)) { 638 } else if (SPIFOPT_OPT_IS_ABSTRACT(j) && SPIFOPT_OPT_VALUE(j) == NULL) {
639 /* Also make sure that abstract options have a function pointer. */ 639 /* Also make sure that abstract options have a function pointer. */
640 NEXT_LOOP(); 640 NEXT_LOOP();
641 } 641 }
diff --git a/src/snprintf.c b/src/snprintf.c
index 6ca1a7b..273f0a1 100644
--- a/src/snprintf.c
+++ b/src/snprintf.c
@@ -239,7 +239,7 @@ fmtstr(char *value, int ljust, int len, int zpad, int precision)
239 int padlen, strlen, i, c; /* amount to pad */ 239 int padlen, strlen, i, c; /* amount to pad */
240 240
241 zpad = 0; 241 zpad = 0;
242 if (!value) { 242 if (value == NULL) {
243 value = "<NULL>"; 243 value = "<NULL>";
244 } 244 }
245 if (precision > 0) { 245 if (precision > 0) {
@@ -382,7 +382,7 @@ dostr(char *str)
382static void 382static void
383dopr_outch(int c) 383dopr_outch(int c)
384{ 384{
385 if (!end || output < end) { 385 if (end == NULL || output < end) {
386 *output++ = c; 386 *output++ = c;
387 } 387 }
388} 388}
diff --git a/src/socket.c b/src/socket.c
index 3939864..cb8d8e3 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -651,8 +651,8 @@ spif_url_init_from_ipaddr(spif_url_t self, spif_ipsockaddr_t ipaddr)
651 do { 651 do {
652 tries++; 652 tries++;
653 hinfo = gethostbyaddr((const char *) &(ipaddr->sin_addr), sizeof(ipaddr->sin_addr), AF_INET); 653 hinfo = gethostbyaddr((const char *) &(ipaddr->sin_addr), sizeof(ipaddr->sin_addr), AF_INET);
654 } while ((tries <= 3) && (!hinfo) && (h_errno == TRY_AGAIN)); 654 } while ((tries <= 3) && (hinfo == NULL) && (h_errno == TRY_AGAIN));
655 if (!hinfo || !hinfo->h_name) { 655 if (hinfo == NULL || hinfo->h_name == NULL) {
656 spif_charptr_t buff; 656 spif_charptr_t buff;
657 657
658 buff = SPIF_CHARPTR(inet_ntoa(ipaddr->sin_addr)); 658 buff = SPIF_CHARPTR(inet_ntoa(ipaddr->sin_addr));
@@ -691,7 +691,7 @@ spif_url_init_from_unixaddr(spif_url_t self, spif_unixsockaddr_t unixaddr)
691 self->port = (spif_str_t) NULL; 691 self->port = (spif_str_t) NULL;
692 self->query = (spif_str_t) NULL; 692 self->query = (spif_str_t) NULL;
693 693
694 if (unixaddr->sun_path) { 694 if (unixaddr->sun_path != NULL) {
695 self->path = spif_str_new_from_ptr(SPIF_CHARPTR(unixaddr->sun_path)); 695 self->path = spif_str_new_from_ptr(SPIF_CHARPTR(unixaddr->sun_path));
696 } else { 696 } else {
697 self->path = (spif_str_t) NULL; 697 self->path = (spif_str_t) NULL;
@@ -719,13 +719,13 @@ spif_url_get_ipaddr(spif_url_t self)
719 do { 719 do {
720 tries++; 720 tries++;
721 hinfo = gethostbyname((char *) SPIF_STR_STR(hostname)); 721 hinfo = gethostbyname((char *) SPIF_STR_STR(hostname));
722 } while ((tries <= 3) && (!hinfo) && (h_errno == TRY_AGAIN)); 722 } while ((tries <= 3) && (hinfo == NULL) && (h_errno == TRY_AGAIN));
723 if (!hinfo) { 723 if (hinfo == NULL) {
724 libast_print_error("Unable to resolve hostname \"%s\" -- %s\n", SPIF_STR_STR(hostname), hstrerror(h_errno)); 724 libast_print_error("Unable to resolve hostname \"%s\" -- %s\n", SPIF_STR_STR(hostname), hstrerror(h_errno));
725 return (spif_ipsockaddr_t) NULL; 725 return (spif_ipsockaddr_t) NULL;
726 } 726 }
727 727
728 if (!hinfo->h_addr_list) { 728 if (hinfo->h_addr_list == NULL) {
729 libast_print_error("Invalid address list returned by gethostbyname()\n"); 729 libast_print_error("Invalid address list returned by gethostbyname()\n");
730 return (spif_ipsockaddr_t) NULL; 730 return (spif_ipsockaddr_t) NULL;
731 } 731 }
@@ -811,19 +811,19 @@ spif_socket_get_proto(spif_socket_t self)
811 /* IP socket. See if they gave us a protocol name. */ 811 /* IP socket. See if they gave us a protocol name. */
812 SPIF_SOCKET_FLAGS_SET(self, SPIF_SOCKET_FLAGS_FAMILY_INET); 812 SPIF_SOCKET_FLAGS_SET(self, SPIF_SOCKET_FLAGS_FAMILY_INET);
813 proto = getprotobyname((char *) SPIF_STR_STR(proto_str)); 813 proto = getprotobyname((char *) SPIF_STR_STR(proto_str));
814 if (!proto) { 814 if (proto == NULL) {
815 /* If it's not a protocol, it's probably a service. */ 815 /* If it's not a protocol, it's probably a service. */
816 serv = getservbyname((char *) SPIF_STR_STR(proto_str), "tcp"); 816 serv = getservbyname((char *) SPIF_STR_STR(proto_str), "tcp");
817 if (!serv) { 817 if (serv == NULL) {
818 serv = getservbyname((char *) SPIF_STR_STR(proto_str), "udp"); 818 serv = getservbyname((char *) SPIF_STR_STR(proto_str), "udp");
819 } 819 }
820 if (serv) { 820 if (serv != NULL) {
821 /* If we found one, get the protocol info too. */ 821 /* If we found one, get the protocol info too. */
822 proto = getprotobyname(serv->s_proto); 822 proto = getprotobyname(serv->s_proto);
823 REQUIRE_RVAL(!!proto, FALSE); 823 REQUIRE_RVAL(proto != NULL, FALSE);
824 } 824 }
825 } 825 }
826 if (proto) { 826 if (proto != NULL) {
827 /* Bingo. Set the flags appropriately. */ 827 /* Bingo. Set the flags appropriately. */
828 self->proto = proto->p_proto; 828 self->proto = proto->p_proto;
829 if (!strcmp(proto->p_name, "tcp")) { 829 if (!strcmp(proto->p_name, "tcp")) {
diff --git a/src/str.c b/src/str.c
index c3ac4c7..83b4ac3 100644
--- a/src/str.c
+++ b/src/str.c
@@ -230,7 +230,8 @@ spif_str_init_from_fp(spif_str_t self, FILE *fp)
230 self->s = (spif_charptr_t) MALLOC(self->size); 230 self->s = (spif_charptr_t) MALLOC(self->size);
231 231
232 for (p = self->s; fgets((char *)p, buff_inc, fp); p += buff_inc) { 232 for (p = self->s; fgets((char *)p, buff_inc, fp); p += buff_inc) {
233 if (!(end = (spif_charptr_t)strchr((const char *)p, '\n'))) { 233 if ((end = (spif_charptr_t)
234 strchr((const char *)p, '\n')) == NULL) {
234 self->size += buff_inc; 235 self->size += buff_inc;
235 self->s = (spif_charptr_t) REALLOC(self->s, self->size); 236 self->s = (spif_charptr_t) REALLOC(self->s, self->size);
236 } else { 237 } else {
diff --git a/src/strings.c b/src/strings.c
index c100462..1195861 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -318,8 +318,8 @@ spiftool_regexp_match_r(register const spif_charptr_t str, register const spif_c
318 register int result; 318 register int result;
319 char errbuf[256]; 319 char errbuf[256];
320 320
321 ASSERT_RVAL(!!rexp, FALSE); 321 ASSERT_RVAL(rexp != NULL, FALSE);
322 if (!*rexp) { 322 if (*rexp == NULL) {
323 *rexp = (regex_t *) MALLOC(sizeof(regex_t)); 323 *rexp = (regex_t *) MALLOC(sizeof(regex_t));
324 } 324 }
325 325
@@ -342,7 +342,7 @@ spiftool_regexp_match_r(register const spif_charptr_t str, register const spif_c
342} 342}
343#endif 343#endif
344 344
345#define IS_DELIM(c) ((delim) ? (strchr((char *)delim, (c))) : (isspace(c))) 345#define IS_DELIM(c) ((delim != NULL) ? (strchr((char *) delim, (c)) != NULL) : (isspace(c)))
346#define IS_QUOTE(c) (quote && quote == (c)) 346#define IS_QUOTE(c) (quote && quote == (c))
347 347
348spif_charptr_t * 348spif_charptr_t *
@@ -355,9 +355,9 @@ spiftool_split(const spif_charptr_t delim, const spif_charptr_t str)
355 unsigned short cnt = 0; 355 unsigned short cnt = 0;
356 unsigned long len; 356 unsigned long len;
357 357
358 REQUIRE_RVAL(!!str, (spif_charptr_t *) NULL); 358 REQUIRE_RVAL(str != NULL, (spif_charptr_t *) NULL);
359 359
360 if (!(slist = (spif_charptr_t *)MALLOC(sizeof(spif_charptr_t)))) { 360 if ((slist = (spif_charptr_t *) MALLOC(sizeof(spif_charptr_t))) == NULL) {
361 libast_print_error("split(): Unable to allocate memory -- %s\n", strerror(errno)); 361 libast_print_error("split(): Unable to allocate memory -- %s\n", strerror(errno));
362 return ((spif_charptr_t *) NULL); 362 return ((spif_charptr_t *) NULL);
363 } 363 }
@@ -370,7 +370,7 @@ spiftool_split(const spif_charptr_t delim, const spif_charptr_t str)
370 for (; *pstr; cnt++) { 370 for (; *pstr; cnt++) {
371 /* First, resize the list to two bigger than our count. Why two? 371 /* First, resize the list to two bigger than our count. Why two?
372 One for the string we're about to do, and one for a trailing NULL. */ 372 One for the string we're about to do, and one for a trailing NULL. */
373 if (!(slist = (spif_charptr_t *)REALLOC(slist, sizeof(spif_charptr_t) * (cnt + 2)))) { 373 if ((slist = (spif_charptr_t *) REALLOC(slist, sizeof(spif_charptr_t) * (cnt + 2))) == NULL) {
374 libast_print_error("split(): Unable to allocate memory -- %s\n", strerror(errno)); 374 libast_print_error("split(): Unable to allocate memory -- %s\n", strerror(errno));
375 return ((spif_charptr_t *) NULL); 375 return ((spif_charptr_t *) NULL);
376 } 376 }
@@ -378,7 +378,7 @@ spiftool_split(const spif_charptr_t delim, const spif_charptr_t str)
378 /* The string we're about to create can't possibly be larger than the remainder 378 /* The string we're about to create can't possibly be larger than the remainder
379 of the string we have yet to parse, so allocate that much space to start. */ 379 of the string we have yet to parse, so allocate that much space to start. */
380 len = strlen((char *) pstr) + 1; 380 len = strlen((char *) pstr) + 1;
381 if (!(slist[cnt] = (spif_charptr_t)MALLOC(len))) { 381 if ((slist[cnt] = (spif_charptr_t) MALLOC(len)) == NULL) {
382 libast_print_error("split(): Unable to allocate memory -- %s.\n", strerror(errno)); 382 libast_print_error("split(): Unable to allocate memory -- %s.\n", strerror(errno));
383 return ((spif_charptr_t *) NULL); 383 return ((spif_charptr_t *) NULL);
384 } 384 }
@@ -446,7 +446,7 @@ spiftool_join(spif_charptr_t sep, spif_charptr_t *slist)
446 446
447 ASSERT_RVAL(slist != (spif_ptr_t) NULL, (spif_ptr_t) NULL); 447 ASSERT_RVAL(slist != (spif_ptr_t) NULL, (spif_ptr_t) NULL);
448 REQUIRE_RVAL(*slist != (spif_ptr_t) NULL, (spif_ptr_t) NULL); 448 REQUIRE_RVAL(*slist != (spif_ptr_t) NULL, (spif_ptr_t) NULL);
449 if (!sep) { 449 if (sep == NULL) {
450 sep = SPIF_CHARPTR(""); 450 sep = SPIF_CHARPTR("");
451 } 451 }
452 slen = strlen((char *) sep); 452 slen = strlen((char *) sep);
@@ -478,7 +478,7 @@ spiftool_get_word(unsigned long index, const spif_charptr_t str)
478 478
479 ASSERT_RVAL(str != (spif_ptr_t) NULL, (spif_ptr_t) NULL); 479 ASSERT_RVAL(str != (spif_ptr_t) NULL, (spif_ptr_t) NULL);
480 k = strlen((char *) str) + 1; 480 k = strlen((char *) str) + 1;
481 if (!(tmpstr = (spif_charptr_t)MALLOC(k))) { 481 if ((tmpstr = (spif_charptr_t) MALLOC(k)) == NULL) {
482 libast_print_error("get_word(%lu, %s): Unable to allocate memory -- %s.\n", index, str, strerror(errno)); 482 libast_print_error("get_word(%lu, %s): Unable to allocate memory -- %s.\n", index, str, strerror(errno));
483 return ((spif_charptr_t) NULL); 483 return ((spif_charptr_t) NULL);
484 } 484 }
@@ -594,7 +594,7 @@ spiftool_chomp(spif_charptr_t s)
594{ 594{
595 register spif_charptr_t front, back; 595 register spif_charptr_t front, back;
596 596
597 ASSERT_RVAL(!!s, NULL); 597 ASSERT_RVAL(s != NULL, NULL);
598 REQUIRE_RVAL(*s, s); 598 REQUIRE_RVAL(*s, s);
599 599
600 for (front = s; *front && isspace(*front); front++); 600 for (front = s; *front && isspace(*front); front++);
diff --git a/src/tok.c b/src/tok.c
index a84c760..7363d1d 100644
--- a/src/tok.c
+++ b/src/tok.c
@@ -275,7 +275,7 @@ spif_tok_type(spif_tok_t self)
275 return SPIF_OBJ_CLASSNAME(self); 275 return SPIF_OBJ_CLASSNAME(self);
276} 276}
277 277
278#define IS_DELIM(c) ((delim) ? (strchr(delim, (c))) : (isspace(c))) 278#define IS_DELIM(c) ((delim != NULL) ? (strchr(delim, (c)) != NULL) : (isspace(c)))
279#define IS_QUOTE(c) (quote && quote == (c)) 279#define IS_QUOTE(c) (quote && quote == (c))
280 280
281spif_bool_t 281spif_bool_t
diff --git a/src/url.c b/src/url.c
index 70f9b00..09bf84a 100644
--- a/src/url.c
+++ b/src/url.c
@@ -262,7 +262,7 @@ spif_url_parse(spif_url_t self)
262 262
263 /* Check for "proto:" at the beginning. */ 263 /* Check for "proto:" at the beginning. */
264 pend = SPIF_CHARPTR(strchr((char *) s, ':')); 264 pend = SPIF_CHARPTR(strchr((char *) s, ':'));
265 if (pend) { 265 if (pend != NULL) {
266 for (; pstr < pend; pstr++) { 266 for (; pstr < pend; pstr++) {
267 if (!isalnum(*pstr)) { 267 if (!isalnum(*pstr)) {
268 break; 268 break;
@@ -284,16 +284,16 @@ spif_url_parse(spif_url_t self)
284 284
285 /* Knock out the path and query if they're there. */ 285 /* Knock out the path and query if they're there. */
286 pend = SPIF_CHARPTR(strchr((char *) pstr, '/')); 286 pend = SPIF_CHARPTR(strchr((char *) pstr, '/'));
287 if (pend) { 287 if (pend != NULL) {
288 spif_charptr_t tmp = SPIF_CHARPTR(strchr((char *) pend, '?')); 288 spif_charptr_t tmp = SPIF_CHARPTR(strchr((char *) pend, '?'));
289 289
290 if (tmp) { 290 if (tmp != NULL) {
291 self->query = spif_str_new_from_ptr(tmp + 1); 291 self->query = spif_str_new_from_ptr(tmp + 1);
292 self->path = spif_str_new_from_buff(pend, tmp - pend); 292 self->path = spif_str_new_from_buff(pend, tmp - pend);
293 } else { 293 } else {
294 self->path = spif_str_new_from_ptr(pend); 294 self->path = spif_str_new_from_ptr(pend);
295 } 295 }
296 } else if ((pend = SPIF_CHARPTR(strchr((char *)pstr, '?')))) { 296 } else if ((pend = SPIF_CHARPTR(strchr((char *) pstr, '?'))) != NULL) {
297 self->query = spif_str_new_from_ptr(pend + 1); 297 self->query = spif_str_new_from_ptr(pend + 1);
298 } else { 298 } else {
299 for (pend = pstr; *pend; pend++); 299 for (pend = pstr; *pend; pend++);
@@ -302,10 +302,10 @@ spif_url_parse(spif_url_t self)
302 302
303 /* Check for an @ sign, which would mean we have auth info. */ 303 /* Check for an @ sign, which would mean we have auth info. */
304 ptmp = SPIF_CHARPTR(strchr((char *) pstr, '@')); 304 ptmp = SPIF_CHARPTR(strchr((char *) pstr, '@'));
305 if ((ptmp) && (ptmp < pend)) { 305 if ((ptmp != NULL) && (ptmp < pend)) {
306 spif_charptr_t tmp = SPIF_CHARPTR(strchr((char *) pstr, ':')); 306 spif_charptr_t tmp = SPIF_CHARPTR(strchr((char *) pstr, ':'));
307 307
308 if ((tmp) && (tmp < ptmp)) { 308 if ((tmp != NULL) && (tmp < ptmp)) {
309 /* Both username and password. */ 309 /* Both username and password. */
310 self->user = spif_str_new_from_buff(pstr, tmp - pstr); 310 self->user = spif_str_new_from_buff(pstr, tmp - pstr);
311 self->passwd = spif_str_new_from_buff((tmp + 1), ptmp - tmp - 1); 311 self->passwd = spif_str_new_from_buff((tmp + 1), ptmp - tmp - 1);
@@ -317,7 +317,7 @@ spif_url_parse(spif_url_t self)
317 317
318 /* All that remains now between pstr and pend is host and maybe port. */ 318 /* All that remains now between pstr and pend is host and maybe port. */
319 ptmp = SPIF_CHARPTR(strchr((char *) pstr, ':')); 319 ptmp = SPIF_CHARPTR(strchr((char *) pstr, ':'));
320 if ((ptmp) && (ptmp < pend)) { 320 if ((ptmp != NULL) && (ptmp < pend)) {
321 self->host = spif_str_new_from_buff(pstr, ptmp - pstr); 321 self->host = spif_str_new_from_buff(pstr, ptmp - pstr);
322 self->port = spif_str_new_from_buff((ptmp + 1), pend - ptmp - 1); 322 self->port = spif_str_new_from_buff((ptmp + 1), pend - ptmp - 1);
323 } else if (pstr != pend) { 323 } else if (pstr != pend) {
@@ -330,18 +330,18 @@ spif_url_parse(spif_url_t self)
330 spif_servinfo_t serv; 330 spif_servinfo_t serv;
331 331
332 proto = getprotobyname((char *) SPIF_STR_STR(self->proto)); 332 proto = getprotobyname((char *) SPIF_STR_STR(self->proto));
333 if (!proto) { 333 if (proto == NULL) {
334 /* If it's not a protocol, it's probably a service. */ 334 /* If it's not a protocol, it's probably a service. */
335 serv = getservbyname((char *) SPIF_STR_STR(self->proto), "tcp"); 335 serv = getservbyname((char *) SPIF_STR_STR(self->proto), "tcp");
336 if (!serv) { 336 if (serv == NULL) {
337 serv = getservbyname((char *) SPIF_STR_STR(self->proto), "udp"); 337 serv = getservbyname((char *) SPIF_STR_STR(self->proto), "udp");
338 } 338 }
339 if (serv) { 339 if (serv != NULL) {
340 proto = getprotobyname(serv->s_proto); 340 proto = getprotobyname(serv->s_proto);
341 REQUIRE_RVAL(!!proto, FALSE); 341 REQUIRE_RVAL(proto != NULL, FALSE);
342 } 342 }
343 } 343 }
344 if (proto) { 344 if (proto != NULL) {
345 spif_char_t buff[32]; 345 spif_char_t buff[32];
346 346
347 snprintf((char *) buff, sizeof(buff), "%d", ntohs(serv->s_port)); 347 snprintf((char *) buff, sizeof(buff), "%d", ntohs(serv->s_port));
diff --git a/src/ustr.c b/src/ustr.c
index 4fb8e91..35c80ab 100644
--- a/src/ustr.c
+++ b/src/ustr.c
@@ -230,7 +230,8 @@ spif_ustr_init_from_fp(spif_ustr_t self, FILE *fp)
230 self->s = (spif_charptr_t) MALLOC(self->size); 230 self->s = (spif_charptr_t) MALLOC(self->size);
231 231
232 for (p = self->s; fgets((char *)p, buff_inc, fp); p += buff_inc) { 232 for (p = self->s; fgets((char *)p, buff_inc, fp); p += buff_inc) {
233 if (!(end = (spif_charptr_t)strchr((const char *)p, '\n'))) { 233 if ((end = (spif_charptr_t)
234 strchr((const char *)p, '\n')) == NULL) {
234 self->size += buff_inc; 235 self->size += buff_inc;
235 self->s = (spif_charptr_t) REALLOC(self->s, self->size); 236 self->s = (spif_charptr_t) REALLOC(self->s, self->size);
236 } else { 237 } else {
diff --git a/test/test.c b/test/test.c
index e73fbb7..1fdff41 100644
--- a/test/test.c
+++ b/test/test.c
@@ -161,8 +161,8 @@ test_strings(void)
161 s3 = spiftool_substr(NULL, 0, 0); 161 s3 = spiftool_substr(NULL, 0, 0);
162 s4 = spiftool_substr(SPIF_CHARPTR("what the heck"), -5, 42); 162 s4 = spiftool_substr(SPIF_CHARPTR("what the heck"), -5, 42);
163 TEST_FAIL_IF(strcmp((char *) s1, "ultramicroscopic")); 163 TEST_FAIL_IF(strcmp((char *) s1, "ultramicroscopic"));
164 TEST_FAIL_IF(!!s2); 164 TEST_FAIL_IF(s2 != NULL);
165 TEST_FAIL_IF(!!s3); 165 TEST_FAIL_IF(s3 != NULL);
166 TEST_FAIL_IF(strcmp((char *) s4, " heck")); 166 TEST_FAIL_IF(strcmp((char *) s4, " heck"));
167 FREE(s1); 167 FREE(s1);
168 FREE(s2); 168 FREE(s2);
@@ -327,15 +327,15 @@ test_options(void)
327 SPIFOPT_FLAGS_SET(SPIFOPT_SETTING_PREPARSE); 327 SPIFOPT_FLAGS_SET(SPIFOPT_SETTING_PREPARSE);
328 spifopt_parse(argc1, argv1); 328 spifopt_parse(argc1, argv1);
329 TEST_FAIL_IF(test_flag_var != 0x10); 329 TEST_FAIL_IF(test_flag_var != 0x10);
330 TEST_FAIL_IF(!!file_var); 330 TEST_FAIL_IF(file_var != NULL);
331 TEST_FAIL_IF(!!exec_list); 331 TEST_FAIL_IF(exec_list != NULL);
332 TEST_FAIL_IF(num_var != 0); 332 TEST_FAIL_IF(num_var != 0);
333 TEST_FAIL_IF(geom_var != 0); 333 TEST_FAIL_IF(geom_var != 0);
334 spifopt_parse(argc1, argv1); 334 spifopt_parse(argc1, argv1);
335 TEST_FAIL_IF(test_flag_var != 0x13); 335 TEST_FAIL_IF(test_flag_var != 0x13);
336 TEST_FAIL_IF(!file_var); 336 TEST_FAIL_IF(file_var == NULL);
337 TEST_FAIL_IF(strcmp((char *) file_var, "somefile")); 337 TEST_FAIL_IF(strcmp((char *) file_var, "somefile"));
338 TEST_FAIL_IF(!exec_list); 338 TEST_FAIL_IF(exec_list == NULL);
339 TEST_FAIL_IF(num_var != 1); 339 TEST_FAIL_IF(num_var != 1);
340 TEST_FAIL_IF(geom_var != 3); 340 TEST_FAIL_IF(geom_var != 3);
341 FREE(file_var); 341 FREE(file_var);
@@ -348,31 +348,31 @@ test_options(void)
348 SPIFOPT_FLAGS_SET(SPIFOPT_SETTING_REMOVE_ARGS); 348 SPIFOPT_FLAGS_SET(SPIFOPT_SETTING_REMOVE_ARGS);
349 spifopt_parse(argc2, argv2); 349 spifopt_parse(argc2, argv2);
350 TEST_FAIL_IF(strcmp((char *) display, "foo:0")); 350 TEST_FAIL_IF(strcmp((char *) display, "foo:0"));
351 TEST_FAIL_IF(!!name); 351 TEST_FAIL_IF(name != NULL);
352 TEST_FAIL_IF(strcmp((char *) theme, "mytheme")); 352 TEST_FAIL_IF(strcmp((char *) theme, "mytheme"));
353 TEST_FAIL_IF(!exec); 353 TEST_FAIL_IF(exec == NULL);
354 TEST_FAIL_IF(strcmp((char *) exec[0], "ssh")); 354 TEST_FAIL_IF(strcmp((char *) exec[0], "ssh"));
355 TEST_FAIL_IF(strcmp((char *) exec[1], "foo@bar.com")); 355 TEST_FAIL_IF(strcmp((char *) exec[1], "foo@bar.com"));
356 TEST_FAIL_IF(!!exec[2]); 356 TEST_FAIL_IF(exec[2] != NULL);
357 TEST_FAIL_IF(!!foo); 357 TEST_FAIL_IF(foo != NULL);
358 TEST_FAIL_IF(color != 0); 358 TEST_FAIL_IF(color != 0);
359 TEST_FAIL_IF(options != 0x08); 359 TEST_FAIL_IF(options != 0x08);
360 spifopt_parse(argc2, argv2); 360 spifopt_parse(argc2, argv2);
361 TEST_FAIL_IF(strcmp((char *) display, "foo:0")); 361 TEST_FAIL_IF(strcmp((char *) display, "foo:0"));
362 TEST_FAIL_IF(strcmp((char *) name, "This is a name")); 362 TEST_FAIL_IF(strcmp((char *) name, "This is a name"));
363 TEST_FAIL_IF(strcmp((char *) theme, "mytheme")); 363 TEST_FAIL_IF(strcmp((char *) theme, "mytheme"));
364 TEST_FAIL_IF(!exec); 364 TEST_FAIL_IF(exec == NULL);
365 TEST_FAIL_IF(strcmp((char *) exec[0], "ssh")); 365 TEST_FAIL_IF(strcmp((char *) exec[0], "ssh"));
366 TEST_FAIL_IF(strcmp((char *) exec[1], "foo@bar.com")); 366 TEST_FAIL_IF(strcmp((char *) exec[1], "foo@bar.com"));
367 TEST_FAIL_IF(!!exec[2]); 367 TEST_FAIL_IF(exec[2] != NULL);
368 TEST_FAIL_IF(!foo); 368 TEST_FAIL_IF(foo == NULL);
369 TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[0])); 369 TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[0]));
370 TEST_FAIL_IF(strcmp((char *) foo[0], "blah")); 370 TEST_FAIL_IF(strcmp((char *) foo[0], "blah"));
371 TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[1])); 371 TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[1]));
372 TEST_FAIL_IF(strcmp((char *) foo[1], "-d")); 372 TEST_FAIL_IF(strcmp((char *) foo[1], "-d"));
373 TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[2])); 373 TEST_FAIL_IF(SPIF_PTR_ISNULL(foo[2]));
374 TEST_FAIL_IF(strcmp((char *) foo[2], "eatme")); 374 TEST_FAIL_IF(strcmp((char *) foo[2], "eatme"));
375 TEST_FAIL_IF(!!foo[3]); 375 TEST_FAIL_IF(foo[3] != NULL);
376 TEST_FAIL_IF(color != 4); 376 TEST_FAIL_IF(color != 4);
377 TEST_FAIL_IF(options != 0x1e); 377 TEST_FAIL_IF(options != 0x1e);
378 TEST_FAIL_IF(strcmp(argv2[0], "test")); 378 TEST_FAIL_IF(strcmp(argv2[0], "test"));
@@ -463,7 +463,7 @@ test_str(void)
463 fp = fdopen(fd, "r"); 463 fp = fdopen(fd, "r");
464 write(mypipe[1], tmp2, sizeof(tmp2)); 464 write(mypipe[1], tmp2, sizeof(tmp2));
465 close(mypipe[1]); 465 close(mypipe[1]);
466 TEST_FAIL_IF(!fp); 466 TEST_FAIL_IF(fp == NULL);
467 teststr = spif_str_new_from_fp(fp); 467 teststr = spif_str_new_from_fp(fp);
468 TEST_FAIL_IF(spif_str_ncmp_with_ptr(teststr, SPIF_CHARPTR("string #1"), 9)); 468 TEST_FAIL_IF(spif_str_ncmp_with_ptr(teststr, SPIF_CHARPTR("string #1"), 9));
469 TEST_FAIL_IF(spif_str_get_len(teststr) != 9); 469 TEST_FAIL_IF(spif_str_get_len(teststr) != 9);
@@ -563,11 +563,11 @@ test_str(void)
563 TEST_BEGIN("spif_str_substr_to_ptr() function"); 563 TEST_BEGIN("spif_str_substr_to_ptr() function");
564 teststr = spif_str_new_from_ptr(SPIF_CHARPTR(tmp)); 564 teststr = spif_str_new_from_ptr(SPIF_CHARPTR(tmp));
565 foo = spif_str_substr_to_ptr(teststr, 2, 5); 565 foo = spif_str_substr_to_ptr(teststr, 2, 5);
566 TEST_FAIL_IF(!foo); 566 TEST_FAIL_IF(foo == NULL);
567 TEST_FAIL_IF(strcmp((char *) foo, "is is")); 567 TEST_FAIL_IF(strcmp((char *) foo, "is is"));
568 FREE(foo); 568 FREE(foo);
569 foo = spif_str_substr_to_ptr(teststr, -4, 4); 569 foo = spif_str_substr_to_ptr(teststr, -4, 4);
570 TEST_FAIL_IF(!foo); 570 TEST_FAIL_IF(foo == NULL);
571 TEST_FAIL_IF(strcmp((char *) foo, "test")); 571 TEST_FAIL_IF(strcmp((char *) foo, "test"));
572 FREE(foo); 572 FREE(foo);
573 spif_str_del(teststr); 573 spif_str_del(teststr);
@@ -842,7 +842,7 @@ test_mbuff(void)
842 fp = fdopen(fd, "r"); 842 fp = fdopen(fd, "r");
843 write(mypipe[1], tmp2, sizeof(tmp2)); 843 write(mypipe[1], tmp2, sizeof(tmp2));
844 close(mypipe[1]); 844 close(mypipe[1]);
845 TEST_FAIL_IF(!fp); 845 TEST_FAIL_IF(fp == NULL);
846 testmbuff = spif_mbuff_new_from_fp(fp); 846 testmbuff = spif_mbuff_new_from_fp(fp);
847 TEST_FAIL_IF(spif_mbuff_cmp_with_ptr(testmbuff, tmp2, sizeof(tmp2))); 847 TEST_FAIL_IF(spif_mbuff_cmp_with_ptr(testmbuff, tmp2, sizeof(tmp2)));
848 TEST_FAIL_IF(spif_mbuff_get_len(testmbuff) != sizeof(tmp2)); 848 TEST_FAIL_IF(spif_mbuff_get_len(testmbuff) != sizeof(tmp2));
@@ -918,11 +918,11 @@ test_mbuff(void)
918 TEST_BEGIN("spif_mbuff_subbuff_to_ptr() function"); 918 TEST_BEGIN("spif_mbuff_subbuff_to_ptr() function");
919 testmbuff = spif_mbuff_new_from_ptr(SPIF_CHARPTR(tmp), strlen(tmp)); 919 testmbuff = spif_mbuff_new_from_ptr(SPIF_CHARPTR(tmp), strlen(tmp));
920 foo = spif_mbuff_subbuff_to_ptr(testmbuff, 2, 5); 920 foo = spif_mbuff_subbuff_to_ptr(testmbuff, 2, 5);
921 TEST_FAIL_IF(!foo); 921 TEST_FAIL_IF(foo == NULL);
922 TEST_FAIL_IF(memcmp((char *) foo, "is is", 5)); 922 TEST_FAIL_IF(memcmp((char *) foo, "is is", 5));
923 FREE(foo); 923 FREE(foo);
924 foo = spif_mbuff_subbuff_to_ptr(testmbuff, -4, 4); 924 foo = spif_mbuff_subbuff_to_ptr(testmbuff, -4, 4);
925 TEST_FAIL_IF(!foo); 925 TEST_FAIL_IF(foo == NULL);
926 TEST_FAIL_IF(memcmp((char *) foo, "test", 5)); 926 TEST_FAIL_IF(memcmp((char *) foo, "test", 5));
927 FREE(foo); 927 FREE(foo);
928 spif_mbuff_del(testmbuff); 928 spif_mbuff_del(testmbuff);
@@ -1057,7 +1057,7 @@ test_ustr(void)
1057 fp = fdopen(fd, "r"); 1057 fp = fdopen(fd, "r");
1058 write(mypipe[1], tmp2, sizeof(tmp2)); 1058 write(mypipe[1], tmp2, sizeof(tmp2));
1059 close(mypipe[1]); 1059 close(mypipe[1]);
1060 TEST_FAIL_IF(!fp); 1060 TEST_FAIL_IF(fp == NULL);
1061 testustr = spif_ustr_new_from_fp(fp); 1061 testustr = spif_ustr_new_from_fp(fp);
1062 TEST_FAIL_IF(spif_ustr_ncmp_with_ptr(testustr, SPIF_CHARPTR("string #1"), 9)); 1062 TEST_FAIL_IF(spif_ustr_ncmp_with_ptr(testustr, SPIF_CHARPTR("string #1"), 9));
1063 TEST_FAIL_IF(spif_ustr_get_len(testustr) != 9); 1063 TEST_FAIL_IF(spif_ustr_get_len(testustr) != 9);
@@ -1157,11 +1157,11 @@ test_ustr(void)
1157 TEST_BEGIN("spif_ustr_substr_to_ptr() function"); 1157 TEST_BEGIN("spif_ustr_substr_to_ptr() function");
1158 testustr = spif_ustr_new_from_ptr(SPIF_CHARPTR(tmp)); 1158 testustr = spif_ustr_new_from_ptr(SPIF_CHARPTR(tmp));
1159 foo = spif_ustr_substr_to_ptr(testustr, 2, 5); 1159 foo = spif_ustr_substr_to_ptr(testustr, 2, 5);
1160 TEST_FAIL_IF(!foo); 1160 TEST_FAIL_IF(foo == NULL);
1161 TEST_FAIL_IF(strcmp((char *) foo, "is is")); 1161 TEST_FAIL_IF(strcmp((char *) foo, "is is"));
1162 FREE(foo); 1162 FREE(foo);
1163 foo = spif_ustr_substr_to_ptr(testustr, -4, 4); 1163 foo = spif_ustr_substr_to_ptr(testustr, -4, 4);
1164 TEST_FAIL_IF(!foo); 1164 TEST_FAIL_IF(foo == NULL);
1165 TEST_FAIL_IF(strcmp((char *) foo, "test")); 1165 TEST_FAIL_IF(strcmp((char *) foo, "test"));
1166 FREE(foo); 1166 FREE(foo);
1167 spif_ustr_del(testustr); 1167 spif_ustr_del(testustr);