diff th_ioctx_mem.c @ 735:31bc1ed07cf5

Renaming BOOL->bool and TRUE/FALSE to true/false, and using stdbool.h if available.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Dec 2022 12:14:39 +0200
parents 29e44a58bc73
children c17eadc60c3d
line wrap: on
line diff
--- a/th_ioctx_mem.c	Wed Dec 07 11:58:54 2022 +0200
+++ b/th_ioctx_mem.c	Wed Dec 07 12:14:39 2022 +0200
@@ -18,7 +18,7 @@
     {
         case 'a':
             // Append
-            ctx->memWrite = TRUE;
+            ctx->memWrite = true;
             ctx->memOffset = ctx->memSize;
             break;
 
@@ -32,7 +32,7 @@
             // Write, so truncate size
             ctx->memOffset = 0;
             ctx->memSize = 0;
-            ctx->memWrite = TRUE;
+            ctx->memWrite = true;
             break;
 
         default:
@@ -54,7 +54,7 @@
 }
 
 
-static BOOL th_mem_realloc(th_ioctx *ctx, const size_t newSize)
+static bool th_mem_realloc(th_ioctx *ctx, const size_t newSize)
 {
     size_t grow;
 
@@ -62,7 +62,7 @@
     if (!ctx->memWrite)
     {
         ctx->status = THERR_FWRITE;
-        return FALSE;
+        return false;
     }
 
     if (ctx->memData == NULL)
@@ -72,7 +72,7 @@
     if (ctx->maxSize > 0 && newSize > ctx->maxSize)
     {
         ctx->status = THERR_BOUNDS;
-        return FALSE;
+        return false;
     }
 
     // New size is smaller than old
@@ -87,7 +87,7 @@
     if (ctx->maxSize > 0 && ctx->memAlloc + grow >= ctx->maxSize)
     {
         ctx->status = THERR_BOUNDS;
-        return FALSE;
+        return false;
     }
 
     // Grow the buffer
@@ -95,13 +95,13 @@
     if ((ctx->memData = th_realloc(ctx->memData, ctx->memAlloc)) == NULL)
     {
         ctx->status = THERR_MALLOC;
-        return FALSE;
+        return false;
     }
 
 out:
     ctx->memSize = newSize;
 
-    return TRUE;
+    return true;
 }
 
 
@@ -171,7 +171,7 @@
 }
 
 
-static BOOL th_mem_feof(th_ioctx *ctx)
+static bool th_mem_feof(th_ioctx *ctx)
 {
     return ((size_t) ctx->memOffset) >= ctx->memSize;
 }