Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
pforemski committed Aug 21, 2014
1 parent 36454a2 commit a6fb2f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sfork.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pid_t pjf_fork(const char *cmd, const char *args, thash *env,
if (pipe(fd_err) < 0) return 0;

child_pid = fork();
if (child_pid < -1) return 0;
if (child_pid < 0) return 0;

if (child_pid == 0) { /* child */
char buf[BUFSIZ];
Expand Down
7 changes: 6 additions & 1 deletion thash.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ void thash_reset(thash *hash);
void *_thash_iter(thash *hash, void **key);
#define thash_iter(a, b) (_thash_iter((a), ((void **) (b))))

/** Safe iterator in case indices are of unsigned int type */
/** Safe iterator in case indices are of unsigned int type
* @param b address of unsigned long variable to write to */
#define thash_uint_iter(a, b) (_thash_iter((a), ((void **) (unsigned long *) (b))))

#define thash_iter_loop(hash, k, v) thash_reset(hash); while (((v) = thash_iter((hash), &(k))))
Expand All @@ -173,6 +174,10 @@ void thash_set(thash *hash, const void *key, const void *val);
/** A safe thash_set in case indices are of unsigned int type */
#define thash_uint_set(a, b, c) (thash_set((a), ((const void *) (unsigned long) b), (c)))

/** A safe thash_set in case indices are of unsigned int type and values are boolean */
#define thash_uint_set_true(a, b) (thash_set((a), ((const void *) (unsigned long) b), ((const void *) (unsigned long) 1)))
#define thash_uint_set_false(a, b) (thash_set((a), ((const void *) (unsigned long) b), ((const void *) (unsigned long) 0)))

/** Returns number of entries in a hash table.
*
* @param hash the hash table
Expand Down

0 comments on commit a6fb2f5

Please sign in to comment.