diff th_datastruct.h @ 453:efd33accdc81

Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase. Introduce optional but default use of stdbool.h.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Jan 2018 22:56:03 +0200
parents 6d29aaeab290
children 347bfd3e017e
line wrap: on
line diff
--- a/th_datastruct.h	Wed Oct 25 22:32:07 2017 +0300
+++ b/th_datastruct.h	Tue Jan 02 22:56:03 2018 +0200
@@ -60,7 +60,7 @@
 } th_ringbuf_t;
 
 th_ringbuf_t * th_ringbuf_new(const size_t size, void (*mdeallocator)(void *));
-BOOL         th_ringbuf_grow(th_ringbuf_t *buf, const size_t n);
+bool         th_ringbuf_grow(th_ringbuf_t *buf, const size_t n);
 void         th_ringbuf_free(th_ringbuf_t *buf);
 void         th_ringbuf_add(th_ringbuf_t *buf, void *ptr);
 
@@ -72,7 +72,7 @@
 
 typedef struct
 {
-    BOOL allocated;
+    bool allocated;
     uint8_t *data;
     size_t size, len, mingrow;
 } th_growbuf_t;
@@ -80,10 +80,10 @@
 
 /* Simple growing string buffer
  */
-BOOL    th_strbuf_grow(char **buf, size_t *bufsize, size_t *len, const size_t grow);
-BOOL    th_strbuf_putch(char **buf, size_t *bufsize, size_t *len, const char ch);
-BOOL    th_strbuf_putsn(char **buf, size_t *bufsize, size_t *len, const char *str, const size_t slen);
-BOOL    th_strbuf_puts(char **buf, size_t *bufsize, size_t *len, const char *str);
+bool    th_strbuf_grow(char **buf, size_t *bufsize, size_t *len, const size_t grow);
+bool    th_strbuf_putch(char **buf, size_t *bufsize, size_t *len, const char ch);
+bool    th_strbuf_putsn(char **buf, size_t *bufsize, size_t *len, const char *str, const size_t slen);
+bool    th_strbuf_puts(char **buf, size_t *bufsize, size_t *len, const char *str);
 
 
 /* Growing byte buffer
@@ -94,15 +94,15 @@
 void    th_growbuf_free(th_growbuf_t *buf);
 
 
-BOOL    th_growbuf_grow(th_growbuf_t *buf, const size_t grow);
-BOOL    th_growbuf_puts(th_growbuf_t *buf, const char *str, BOOL eos);
-BOOL    th_growbuf_putch(th_growbuf_t *buf, const char ch);
-BOOL    th_growbuf_put_str(th_growbuf_t *buf, const void *s, const size_t len);
-BOOL    th_growbuf_put_u8(th_growbuf_t *buf, const uint8_t val);
-BOOL    th_growbuf_put_u16_be(th_growbuf_t *buf, const uint16_t val);
-BOOL    th_growbuf_put_u16_le(th_growbuf_t *buf, const uint16_t val);
-BOOL    th_growbuf_put_u32_be(th_growbuf_t *buf, const uint32_t val);
-BOOL    th_growbuf_put_u32_le(th_growbuf_t *buf, const uint32_t val);
+bool    th_growbuf_grow(th_growbuf_t *buf, const size_t grow);
+bool    th_growbuf_puts(th_growbuf_t *buf, const char *str, bool eos);
+bool    th_growbuf_putch(th_growbuf_t *buf, const char ch);
+bool    th_growbuf_put_str(th_growbuf_t *buf, const void *s, const size_t len);
+bool    th_growbuf_put_u8(th_growbuf_t *buf, const uint8_t val);
+bool    th_growbuf_put_u16_be(th_growbuf_t *buf, const uint16_t val);
+bool    th_growbuf_put_u16_le(th_growbuf_t *buf, const uint16_t val);
+bool    th_growbuf_put_u32_be(th_growbuf_t *buf, const uint32_t val);
+bool    th_growbuf_put_u32_le(th_growbuf_t *buf, const uint32_t val);
 
 
 #ifdef __cplusplus