summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-04-04 18:31:59 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-04-04 21:12:12 +0900
commit1e4fe94fcf03e933af64681bbda8aba22724679d (patch)
treec6d5c47248d87408706e520231258f3e6af3db7e
parent36afce6e3c868cf3b7d348b0a6f251898888d931 (diff)
downloadlibr-r14.1.4.tar.gz
libr-r14.1.4.zip
Replace TRUE/FALSE with boolean values true/falser14.1.4
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 090b467fe2ab0274cee1e20b46fc1eec05f40bb8)
-rw-r--r--src/onecanvas.c16
-rw-r--r--src/tempfiles.c22
2 files changed, 15 insertions, 23 deletions
diff --git a/src/onecanvas.c b/src/onecanvas.c
index e53ece7..ba80175 100644
--- a/src/onecanvas.c
+++ b/src/onecanvas.c
@@ -28,11 +28,9 @@
#include <string.h>
#include <math.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <time.h>
-#define FALSE 0
-#define TRUE 1
-
typedef struct {
double x;
double y;
@@ -115,7 +113,7 @@ static inline char *xml_getTagName(char *c)
static inline char *xml_getTagAttributePtr(char *c, char *attrname)
{
char *end, *name;
- int found;
+ bool found = false;
if(++c == NULL)
return NULL;
@@ -138,7 +136,7 @@ static inline char *xml_getTagAttributePtr(char *c, char *attrname)
continue;
if(strncasecmp(attrname, name, name_len) == 0)
{
- found = TRUE;
+ found = true;
break;
}
}
@@ -212,15 +210,15 @@ static inline char *xml_idMatchStart(char *stream_pos, char *layer_name)
* Match the entirety of an XML tag by "id" (preferred) or Inkscape's
* label (undesireable but acceptable).
*/
-static inline int xml_idMatch(char *stream_pos, char *layer_name)
+static inline bool xml_idMatch(char *stream_pos, char *layer_name)
{
char *id_acceptable = xml_getTagAttribute(stream_pos, "inkscape:label");
char *id_preferred = xml_getTagAttribute(stream_pos, "id");
- int ret = FALSE;
+ bool ret = false;
if((id_preferred && strcasecmp(id_preferred, layer_name) == 0)
|| (id_acceptable && strcasecmp(id_acceptable, layer_name) == 0))
- ret = TRUE;
+ ret = true;
free(id_acceptable);
free(id_preferred);
return ret;
@@ -443,4 +441,4 @@ char *onecanvas_geticon_bysize(char *icon_data, int requested_size)
free(info.iconlist[i]);
free(info.iconlist);
return ret;
-} \ No newline at end of file
+}
diff --git a/src/tempfiles.c b/src/tempfiles.c
index e4f633f..47c3091 100644
--- a/src/tempfiles.c
+++ b/src/tempfiles.c
@@ -28,6 +28,7 @@
/* For malloc/free and mkdtemp */
#include <stdlib.h>
+#include <stdbool.h>
/* For string handling */
#include <string.h>
@@ -46,13 +47,6 @@
#include <sys/syslimits.h>
#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/* Hold on to folder names for cleanup when libr is removed from memory */
@@ -64,7 +58,7 @@ CleanupFolder *folders_to_remove = NULL;
/* Hold on to libr handles for cleanup when libr is removed from memory */
typedef struct CLEANUPHANDLE {
- int internal; /* do not warn the user about cleaning this handle up */
+ bool internal; /* do not warn the user about cleaning this handle up */
libr_file *handle;
struct CLEANUPHANDLE *next;
} CleanupHandle;
@@ -100,7 +94,7 @@ void register_handle_cleanup(libr_file *handle)
CleanupHandle *h = malloc(sizeof(CleanupHandle));
h->handle = handle;
- h->internal = FALSE;
+ h->internal = false;
h->next = NULL;
if(handles_to_remove != NULL)
{
@@ -119,7 +113,7 @@ void register_handle_cleanup(libr_file *handle)
void unregister_handle_cleanup(libr_file *handle)
{
CleanupHandle *i, *last = NULL;
- int found = FALSE;
+ bool found = false;
if(handles_to_remove == NULL)
{
@@ -135,7 +129,7 @@ void unregister_handle_cleanup(libr_file *handle)
else
last->next = i->next;
free(i);
- found = TRUE;
+ found = true;
break;
}
}
@@ -148,7 +142,7 @@ void unregister_handle_cleanup(libr_file *handle)
*/
void register_internal_handle(libr_file *handle)
{
- int found = FALSE;
+ bool found = false;
CleanupHandle *i;
if(handles_to_remove == NULL)
@@ -160,8 +154,8 @@ void register_internal_handle(libr_file *handle)
{
if(i->handle == handle)
{
- i->internal = TRUE;
- found = TRUE;
+ i->internal = true;
+ found = true;
break;
}
}