Replace TRUE and FALSE for lowercase version.

Fri, 07 May 2021 13:29:07 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 07 May 2021 13:29:07 +0200
changeset 747
b6fbe6821468
parent 746
44d929ff268e
child 748
1ecacd35c2a6

Replace TRUE and FALSE for lowercase version.

bmsd/bms.c file | annotate | diff | comparison | revisions
bmsd/bms.h file | annotate | diff | comparison | revisions
bmsd/futil.c file | annotate | diff | comparison | revisions
bmsd/lock.c file | annotate | diff | comparison | revisions
bmsd/mqtt.c file | annotate | diff | comparison | revisions
bmsd/mysql.c file | annotate | diff | comparison | revisions
bmsd/rdconfig.c file | annotate | diff | comparison | revisions
--- a/bmsd/bms.c	Fri May 07 13:20:53 2021 +0200
+++ b/bmsd/bms.c	Fri May 07 13:29:07 2021 +0200
@@ -31,8 +31,8 @@
 #include "websocket.h"
 
 
-int			my_shutdown = FALSE;
-int			debug = FALSE;
+int			my_shutdown = false;
+int			debug = false;
 static pid_t		mypid;
 char			*Private_Path = NULL;	/* Users data path		*/
 pthread_t		ws_thread;
@@ -61,12 +61,12 @@
 	case SIGTERM:   syslog(LOG_NOTICE, "Got SIGTERM, shutting down");
 			break;
 	case SIGSEGV:   syslog(LOG_NOTICE, "Got SIGSEGV, shutting down");
-			my_shutdown = TRUE;
+			my_shutdown = true;
 			exit(SIGSEGV);
 			break;
 	default:        syslog(LOG_NOTICE, "die() on signal %d", onsig);
     }
-    my_shutdown = TRUE;
+    my_shutdown = true;
 }
 
 
@@ -184,7 +184,7 @@
     if (debug)
 	fprintf(stdout, "[main] Entering main loop\n");
 
-    while (my_shutdown == FALSE) {
+    while (my_shutdown == false) {
 
 	usleep(3000000);
 	nodes_check_online();
@@ -235,7 +235,7 @@
 	if (c == -1)
 	    break;
 	switch (c) {
-	    case 'd':   debug = TRUE;
+	    case 'd':   debug = true;
 			break;
 	    case 'h':   help();
 			return 1;
--- a/bmsd/bms.h	Fri May 07 13:20:53 2021 +0200
+++ b/bmsd/bms.h	Fri May 07 13:29:07 2021 +0200
@@ -5,8 +5,6 @@
 #ifndef	_BMS_H
 #define	_BMS_H
 
-#define TRUE 1
-#define FALSE 0
 
 #define _GNU_SOURCE  // for secure_getenv()
 
--- a/bmsd/futil.c	Fri May 07 13:20:53 2021 +0200
+++ b/bmsd/futil.c	Fri May 07 13:29:07 2021 +0200
@@ -50,10 +50,10 @@
     umask(oldmask);
 											
     if ((last == 0) || (last == EEXIST)) {
-	return TRUE;
+	return true;
     } else {
 	syslog(LOG_NOTICE, "mkdirs(%s): %s", name, strerror(last));
-	return FALSE;
+	return false;
     }
 }
 
--- a/bmsd/lock.c	Fri May 07 13:20:53 2021 +0200
+++ b/bmsd/lock.c	Fri May 07 13:29:07 2021 +0200
@@ -43,7 +43,7 @@
     snprintf(tempfile, PATH_MAX, "%s/run/%s.tmp", Private_Path, name);
     snprintf(lockfile, PATH_MAX, "%s/run/%s.pid", Private_Path, name);
 
-    if (mkdirs(tempfile, 0755) == FALSE) {
+    if (mkdirs(tempfile, 0755) == false) {
 	syslog(LOG_NOTICE, "Can't create path `%s': %s", tempfile, strerror(errno));
 	free(tempfile);
 	free(lockfile);
@@ -59,7 +59,7 @@
     fprintf(fp, "%u\n", getpid());
     fclose(fp);
 
-    while (TRUE) {
+    while (true) {
 	if (link(tempfile, lockfile) == 0) {
 	    unlink(tempfile);
 	    free(tempfile);
--- a/bmsd/mqtt.c	Fri May 07 13:20:53 2021 +0200
+++ b/bmsd/mqtt.c	Fri May 07 13:29:07 2021 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2017-2020
+ * Copyright (C) 2017-2021
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -40,11 +40,11 @@
 int              	mqtt_mid_sent = 0;
 int              	mqtt_last_mid = -1;
 int              	mqtt_last_mid_sent = -1;
-int              	mqtt_connected = TRUE;
-int              	mqtt_disconnect_sent = FALSE;
-int              	mqtt_connect_lost = FALSE;
-int              	mqtt_my_shutdown = FALSE;
-int              	mqtt_use = FALSE;
+int              	mqtt_connected = true;
+int              	mqtt_disconnect_sent = false;
+int              	mqtt_connect_lost = false;
+int              	mqtt_my_shutdown = false;
+int              	mqtt_use = false;
 int			keepalive = 60;
 unsigned int		max_inflight = 20;
 struct mosquitto	*mosq = NULL;
@@ -88,7 +88,7 @@
     char	*topic = NULL;
 
     if (mqtt_connect_lost) {
-        mqtt_connect_lost = FALSE;
+        mqtt_connect_lost = false;
         syslog(LOG_NOTICE, "MQTT: reconnect: %s", mosquitto_connack_string(result));
     }
 
@@ -119,13 +119,13 @@
 {
     if (mqtt_my_shutdown) {
        	syslog(LOG_NOTICE, "MQTT: acknowledged DISCONNECT from %s", Config.mqtt_host);
-       	mqtt_connected = FALSE;
+       	mqtt_connected = false;
     } else {
        	/*
          * The remote server was brought down. We must keep running
          */
        	syslog(LOG_NOTICE, "MQTT: received DISCONNECT from %s, connection lost", Config.mqtt_host);
-       	mqtt_connect_lost = TRUE;
+       	mqtt_connect_lost = true;
     }
 }
 
@@ -300,7 +300,7 @@
        id[MOSQ_MQTT_ID_MAX_LENGTH] = '\0';
     }
 
-    mosq = mosquitto_new(id, TRUE, NULL);
+    mosq = mosquitto_new(id, true, NULL);
     if (!mosq) {
        switch(errno) {
            case ENOMEM:
@@ -370,7 +370,7 @@
 	syslog(LOG_NOTICE, "MQTT: will run without an MQTT broker.");
 	return 4;
     } else {
-        mqtt_use = TRUE;
+        mqtt_use = true;
         syslog(LOG_NOTICE, "MQTT: connected with %s:%d", Config.mqtt_host, Config.mqtt_port);
 
         /*
@@ -405,33 +405,33 @@
 	topic = NULL;
 	mqtt_last_mid = mqtt_mid_sent;
         mqtt_status = STATUS_WAITING;
-	mqtt_my_shutdown = TRUE;
+	mqtt_my_shutdown = true;
 
         do {
             if (mqtt_status == STATUS_WAITING) {
                 if (debug)
                     fprintf(stdout, (char *)"Waiting\n");
-                if (mqtt_last_mid_sent == mqtt_last_mid && mqtt_disconnect_sent == FALSE) {
+                if (mqtt_last_mid_sent == mqtt_last_mid && mqtt_disconnect_sent == false) {
                     mosquitto_disconnect(mosq);
-                    mqtt_disconnect_sent = TRUE;
+                    mqtt_disconnect_sent = true;
                 }
                 usleep(100000);
             }
             rc = MOSQ_ERR_SUCCESS;
         } while (rc == MOSQ_ERR_SUCCESS && mqtt_connected);
 
-        mosquitto_loop_stop(mosq, FALSE);
+        mosquitto_loop_stop(mosq, false);
         mosquitto_destroy(mosq);
         mosquitto_lib_cleanup();
-	mqtt_use = FALSE;
+	mqtt_use = false;
 	mqtt_status = STATUS_CONNECTING;
 	mqtt_mid_sent = 0;
 	mqtt_last_mid = -1;
 	mqtt_last_mid_sent = -1;
-	mqtt_connected = TRUE;
-	mqtt_disconnect_sent = FALSE;
-	mqtt_connect_lost = FALSE;
-	mqtt_my_shutdown = FALSE;
+	mqtt_connected = true;
+	mqtt_disconnect_sent = false;
+	mqtt_connect_lost = false;
+	mqtt_my_shutdown = false;
 	syslog(LOG_NOTICE, "MQTT: disconnected");
     }
 }
--- a/bmsd/mysql.c	Fri May 07 13:20:53 2021 +0200
+++ b/bmsd/mysql.c	Fri May 07 13:29:07 2021 +0200
@@ -3,7 +3,7 @@
  * @brief MySQL/MariaDB access.
  * @author Michiel Broek <mbroek at mbse dot eu>
  *
- * Copyright (C) 2018-2020
+ * Copyright (C) 2018-2021
  *
  * This file is part of the bms (Brewery Management System)
  *
--- a/bmsd/rdconfig.c	Fri May 07 13:20:53 2021 +0200
+++ b/bmsd/rdconfig.c	Fri May 07 13:29:07 2021 +0200
@@ -113,7 +113,7 @@
 	free(mypath);
     mypath = xstrcpy(Private_Path);
     mypath = xstrcat(mypath, (char *)"/bms.config");
-    if (mkdirs(mypath, 0755) == FALSE)
+    if (mkdirs(mypath, 0755) == false)
 	return 1;
 
     if ((fp = fopen(mypath, "w")) == NULL) {

mercurial