From 9c594550554ad05e95a20eb8a3b35c5c3a235b88 Mon Sep 17 00:00:00 2001 From: bel2125 Date: Fri, 25 Aug 2017 20:29:18 +0200 Subject: [PATCH] Remove dependency to stdbool.h 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 https://github.com/libcheck/check/issues/125). --- src/check_list.c | 6 +++--- src/check_list.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/check_list.c b/src/check_list.c index 00c71517..d93f51c8 100644 --- a/src/check_list.c +++ b/src/check_list.c @@ -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; } diff --git a/src/check_list.h b/src/check_list.h index 8b7a9952..e0b5c8c2 100644 --- a/src/check_list.h +++ b/src/check_list.h @@ -21,8 +21,6 @@ #ifndef CHECK_LIST_H #define CHECK_LIST_H -#include - typedef struct List List; /* Create an empty list */ @@ -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 */