Skip to content

Commit

Permalink
Remove dependency to stdbool.h
Browse files Browse the repository at this point in the history
While this header is standard in C99, it does not exist in C89/C90.
Microsoft Visual Studio added this header only in version 2013.
Still common common compilers Visual Studio 2010 and 2012 (and all earlier)
do not support it.

Here we do not really have a benefit as compared to just using 'int'
instead of 'bool', so this dependency can easily be avoided to support
Visual Studio 2010 (see also libcheck#125).
  • Loading branch information
bel2125 committed Aug 25, 2017
1 parent 34c184e commit 9c59455
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/check_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ void check_list_apply(List * lp, void (*fp) (void *))

}

bool check_list_contains(List * lp, void *val)
int check_list_contains(List * lp, void *val)
{
for(check_list_front(lp); !check_list_at_end(lp); check_list_advance(lp))
{
if(check_list_val(lp) == val)
{
return true;
return 1;
}
}

return false;
return 0;
}
4 changes: 1 addition & 3 deletions src/check_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#ifndef CHECK_LIST_H
#define CHECK_LIST_H

#include <stdbool.h>

typedef struct List List;

/* Create an empty list */
Expand Down Expand Up @@ -55,7 +53,7 @@ void check_list_free(List * lp);
void check_list_apply(List * lp, void (*fp) (void *));

/* Return true if the list contains the value, false otherwise */
bool check_list_contains(List * lp, void *val);
int check_list_contains(List * lp, void *val);


#endif /* CHECK_LIST_H */

0 comments on commit 9c59455

Please sign in to comment.