changeset 129:aa2d608fb3f3

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Jun 2014 07:23:54 +0300
parents c22caa6e3fcb
children 32dcabfc2644
files th_args.h th_config.c th_config.h th_endian.h th_ioctx.h th_network.h th_string.c th_string.h th_types.h th_util.c th_util.h
diffstat 11 files changed, 80 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/th_args.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_args.h	Sun Jun 22 07:23:54 2014 +0300
@@ -17,11 +17,11 @@
 
 /* Option flags
  */
-#define OPT_NONE       (0)    /* Simple option with no arguments */
-#define OPT_ARGREQ     (1)    /* Option's argument is required */
-#define OPT_ARGOPT     (3)    /* Option's argument is optional */
-#define OPT_ARGMASK    (3)    /* Mask for option argument flags */
-#define OPT_REQUIRED   (4)    /* This option is required to be given */
+#define OPT_NONE       (0)    // Simple option with no arguments
+#define OPT_ARGREQ     (1)    // Option's argument is required
+#define OPT_ARGOPT     (3)    // Option's argument is optional
+#define OPT_ARGMASK    (3)    // Mask for option argument flags
+#define OPT_REQUIRED   (4)    // This option is required to be given
 
 
 typedef struct {
@@ -43,4 +43,4 @@
 #ifdef __cplusplus
 }
 #endif
-#endif /* TH_ARGS */
+#endif // TH_ARGS
--- a/th_config.c	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_config.c	Sun Jun 22 07:23:54 2014 +0300
@@ -44,17 +44,17 @@
     if (cfg == NULL)
         return NULL;
 
-    /* Allocate new item */
+    // Allocate new item
     node = (th_cfgitem_t *) th_malloc0(sizeof(th_cfgitem_t));
     if (node == NULL)
         return NULL;
 
-    /* Set values */
+    // Set values
     node->type = type;
     node->v.data = data;
     node->name = th_strdup(name);
 
-    /* Insert into linked list */
+    // Insert into linked list
     if (*cfg != NULL)
     {
         node->prev = (*cfg)->prev;
@@ -226,7 +226,7 @@
     int c, parseMode, prevMode, nextMode, tmpCh;
     BOOL isFound, isStart, isError, validError;
 
-    /* Initialize values */
+    // Initialize values
     tmpCh = 0;
     strPos = 0;
     c = -1;
@@ -236,12 +236,12 @@
     if ((tmpStr = th_malloc(SET_MAX_BUF + 1)) == NULL)
         goto out;
 
-    /* Parse the configuration */
+    // Parse the configuration
     while (parseMode != PM_EOF && parseMode != PM_ERROR)
     {
         if (c == -1)
         {
-            /* Get next character */
+            // Get next character
             switch (c = fgetc(ctx->fp))
             {
             case EOF:
@@ -262,10 +262,10 @@
         switch (parseMode)
         {
         case PM_COMMENT:
-            /* Comment parsing mode */
+            // Comment parsing mode
             if (c == '\n')
             {
-                /* End of line, end of comment */
+                // End of line, end of comment
                 parseMode = prevMode;
                 prevMode = PM_COMMENT;
             }
@@ -273,7 +273,7 @@
             break;
 
         case PM_NORMAL:
-            /* Normal parsing mode */
+            // Normal parsing mode
             if (c == '#')
             {
                 prevMode = parseMode;
@@ -287,7 +287,7 @@
             else if (c == '}')
             {
                 if (nesting > 0)
-                    /* Check for validation errors */
+                    // Check for validation errors
                     goto out;
                 else
                 {
@@ -298,42 +298,42 @@
             }
             else if (th_isalpha(c))
             {
-                /* Start of key name found */
+                // Start of key name found
                 prevMode = parseMode;
                 parseMode = PM_KEYNAME;
                 strPos = 0;
             }
             else
             {
-                /* Error! Invalid character found */
+                // Error! Invalid character found
                 th_ioctx_error(ctx, -1, "Unexpected character '%c'.\n", c);
                 parseMode = PM_ERROR;
             }
             break;
 
         case PM_KEYNAME:
-            /* Configuration KEY name parsing mode */
+            // Configuration KEY name parsing mode
             if (c == '#')
             {
-                /* Start of comment */
+                // Start of comment
                 prevMode = parseMode;
                 parseMode = PM_COMMENT;
                 c = -1;
             }
             else if (th_iscrlf(c) || th_isspace(c) || c == '=')
             {
-                /* End of key name */
+                // End of key name
                 prevMode = parseMode;
                 parseMode = PM_NEXT;
                 nextMode = PM_KEYSET;
             }
             else if (th_isalnum(c) || c == '_')
             {
-                /* Add to key name string */
+                // Add to key name string
                 VADDCH(c)
                 else
                 {
-                    /* Error! Key name string too long! */
+                    // Error! Key name string too long!
                     th_ioctx_error(ctx, -1, "Config key name too long!");
                     parseMode = PM_ERROR;
                 }
@@ -341,7 +341,7 @@
             }
             else
             {
-                /* Error! Invalid character found */
+                // Error! Invalid character found
                 tmpStr[strPos] = 0;
                 th_ioctx_error(ctx, -1,
                     "Unexpected character '%c' in key name '%s'.\n",
@@ -353,7 +353,7 @@
         case PM_KEYSET:
             if (c == '=')
             {
-                /* Find key from configuration */
+                // Find key from configuration
                 tmpStr[strPos] = 0;
                 isFound = FALSE;
                 item = cfg;
@@ -365,10 +365,10 @@
                         item = item->next;
                 }
 
-                /* Check if key was found */
+                // Check if key was found
                 if (isFound)
                 {
-                    /* Okay, set next mode */
+                    // Okay, set next mode
                     switch (item->type)
                     {
                     case ITEM_HEX_TRIPLET:
@@ -401,7 +401,7 @@
                 }
                 else
                 {
-                    /* Error! No configuration key by this name found */
+                    // Error! No configuration key by this name found
                     th_ioctx_error(ctx, -1,
                         "No such configuration setting ('%s')\n",
                         tmpStr);
@@ -412,7 +412,7 @@
             }
             else
             {
-                /* Error! '=' expected! */
+                // Error! '=' expected!
                 th_ioctx_error(ctx, -1,
                     "Unexpected character '%c', assignation '=' was expected.\n",
                     c);
@@ -421,21 +421,21 @@
             break;
 
         case PM_NEXT:
-            /* Search next item parsing mode */
+            // Search next item parsing mode
             if (c == '#')
             {
-                /* Start of comment */
+                // Start of comment
                 prevMode = parseMode;
                 parseMode = PM_COMMENT;
             }
             else if (th_isspace(c) || th_iscrlf(c))
             {
-                /* Ignore whitespaces and linechanges */
+                // Ignore whitespaces and linechanges
                 c = -1;
             }
             else
             {
-                /* Next item found */
+                // Next item found
                 prevMode = parseMode;
                 parseMode = nextMode;
             }
@@ -473,10 +473,10 @@
             break;
 
         case PM_SECTION:
-            /* Section parsing mode */
+            // Section parsing mode
             if (c != '{')
             {
-                /* Error! Section start '{' expected! */
+                // Error! Section start '{' expected!
                 th_ioctx_error(ctx, -1,
                     "Unexpected character '%c', section start '{' was expected.\n",
                     c);
@@ -499,17 +499,17 @@
             break;
 
         case PM_STRING:
-            /* String parsing mode */
+            // String parsing mode
             if (isStart)
             {
-                /* Start of string, get delimiter */
+                // Start of string, get delimiter
                 tmpCh = c;
                 isStart = FALSE;
                 strPos = 0;
             }
             else if (c == tmpCh)
             {
-                /* End of string, set the value */
+                // End of string, set the value
                 tmpStr[strPos] = 0;
 
                 switch (item->type)
@@ -535,11 +535,11 @@
             }
             else
             {
-                /* Add character to string */
+                // Add character to string
                 VADDCH(c)
                 else
                 {
-                    /* Error! String too long! */
+                    // Error! String too long!
                     th_ioctx_error(ctx, -1,
                         "String too long! Maximum is %d characters.",
                         SET_MAX_BUF);
@@ -551,10 +551,10 @@
             break;
 
         case PM_INT:
-            /* Integer parsing mode */
+            // Integer parsing mode
             if (isStart && item->type == ITEM_UINT && c == '-')
             {
-                /* Error! Negative values not allowed for unsigned ints */
+                // Error! Negative values not allowed for unsigned ints
                 th_ioctx_error(ctx, -1,
                     "Negative value specified for %s, unsigned value expected.",
                     item->name);
@@ -574,7 +574,7 @@
             }
             else if (VISEND(c))
             {
-                /* End of integer parsing mode */
+                // End of integer parsing mode
                 tmpStr[strPos] = 0;
                 switch (item->type)
                 {
@@ -592,7 +592,7 @@
             }
             else
             {
-                /* Error! Unexpected character. */
+                // Error! Unexpected character.
                 th_ioctx_error(ctx, -1,
                     "Unexpected character '%c' for integer setting '%s'.",
                     c, item->name);
@@ -601,7 +601,7 @@
 
             if (isError)
             {
-                /* Error! String too long! */
+                // Error! String too long!
                 th_ioctx_error(ctx, -1,
                     "String too long! Maximum is %d characters.",
                     SET_MAX_BUF);
@@ -613,7 +613,7 @@
             break;
 
         case PM_BOOL:
-            /* Boolean parsing mode */
+            // Boolean parsing mode
             if (isStart)
             {
                 tmpCh = c;
@@ -623,7 +623,7 @@
             {
                 BOOL tmpBool = FALSE;
 
-                /* End of boolean parsing */
+                // End of boolean parsing
                 switch (tmpCh)
                 {
                 case 'Y':
@@ -669,11 +669,11 @@
 out:
     th_free(tmpStr);
 
-    /* Check for validation errors */
+    // Check for validation errors
     if (validError)
         return 1;
 
-    /* Return result */
+    // Return result
     if (parseMode == PM_ERROR)
         return -2;
     else
--- a/th_config.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_config.h	Sun Jun 22 07:23:54 2014 +0300
@@ -74,4 +74,4 @@
 #ifdef __cplusplus
 }
 #endif
-#endif /* TH_CONFIG_H */
+#endif // TH_CONFIG_H
--- a/th_endian.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_endian.h	Sun Jun 22 07:23:54 2014 +0300
@@ -74,7 +74,7 @@
 #define TH_NATIVE_TO_BE64(value) ((uint64_t) (value))
 #endif
 
-/* !TH_BIG_ENDIAN */
+// !TH_BIG_ENDIAN
 #elif (TH_BYTEORDER == TH_LITTLE_ENDIAN)
 
 #define TH_LE16_TO_NATIVE(value) ((uint16_t) (value))
@@ -123,7 +123,7 @@
 
 #undef TH_DEFINE_HEADER
 
-/* Cause warnings for old functions */
+// Cause warnings for old functions
 #define TH_READ_LE16    fdksajlkfdsljf lol
 #define TH_READ_LE32    fdksajlkfdsljf lol
 #define TH_READ_BE16    fdksajlkfdsljf lol
@@ -132,4 +132,4 @@
 #ifdef __cplusplus
 }
 #endif
-#endif /* TH_ENDIAN_H */
+#endif // TH_ENDIAN_H
--- a/th_ioctx.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_ioctx.h	Sun Jun 22 07:23:54 2014 +0300
@@ -51,4 +51,4 @@
 #ifdef __cplusplus
 }
 #endif
-#endif /* TH_IOCTX_H */
+#endif // TH_IOCTX_H
--- a/th_network.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_network.h	Sun Jun 22 07:23:54 2014 +0300
@@ -163,4 +163,4 @@
 #ifdef __cplusplus
 }
 #endif
-#endif /* TH_NETWORK_H */
+#endif // TH_NETWORK_H
--- a/th_string.c	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_string.c	Sun Jun 22 07:23:54 2014 +0300
@@ -288,7 +288,7 @@
 {
     assert(str != NULL);
 
-    /* Terminating NULL-character is not whitespace! */
+    // Terminating NULL-character is not whitespace!
     while (th_isspace(str[*pos]))
         (*pos)++;
 
@@ -332,17 +332,17 @@
     BOOL didMatch = TRUE, isAnyMode = FALSE, isEnd = FALSE;
     const char *tmpPattern = NULL;
 
-    /* Check given pattern and string */
+    // Check given pattern and string
     if (str == NULL || pattern == NULL)
         return FALSE;
 
-    /* Start comparision */
+    // Start comparision
     do {
         didMatch = FALSE;
         switch (*pattern)
         {
         case '?':
-            /* Any single character matches */
+            // Any single character matches
             if (*str)
             {
                 didMatch = TRUE;
@@ -426,7 +426,7 @@
                 isEnd = TRUE;
             break;
 
-        }        /* switch */
+        }        // switch
 
     } while (didMatch && !isEnd);
 
@@ -441,15 +441,15 @@
     BOOL didMatch = TRUE, isAnyMode = FALSE, isEnd = FALSE;
     const char *tmpPattern = NULL;
 
-    /* Check given pattern and string */
+    // Check given pattern and string
     if (str == NULL || pattern == NULL)
         return FALSE;
 
-    /* Start comparision */
+    // Start comparision
     do {
         switch (*pattern) {
         case '?':
-            /* Any single character matches */
+            // Any single character matches
             if (*str)
             {
                 pattern++;
@@ -533,7 +533,7 @@
 
             break;
 
-        }        /* switch */
+        }        // switch
 
     } while (didMatch && !isEnd);
 
--- a/th_string.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_string.h	Sun Jun 22 07:23:54 2014 +0300
@@ -83,4 +83,4 @@
 #ifdef __cplusplus
 }
 #endif
-#endif /* TH_STRING_H */
+#endif // TH_STRING_H
--- a/th_types.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_types.h	Sun Jun 22 07:23:54 2014 +0300
@@ -25,7 +25,7 @@
 #endif
 #endif
 
-/* Shorthand types */
+// Shorthand types
 typedef unsigned long int ulint_t;
 typedef signed long int lint_t;
 #ifndef HAVE_UINT_T
@@ -36,8 +36,8 @@
  * feel free to define TH_TYPE_* if necessary to remedy
  */
 #ifdef TH_TYPE_I8
-typedef unsigned TH_TYPE_I8 uint8_t;    /* 8 bits, unsigned */
-typedef signed TH_TYPE_I8 int8_t;    /* 8 bits, signed */
+typedef unsigned TH_TYPE_I8 uint8_t;    // 8 bits, unsigned
+typedef signed TH_TYPE_I8 int8_t;    // 8 bits, signed
 #else
 #ifndef HAVE_INT_TYPES
 typedef unsigned char uint8_t;
@@ -47,8 +47,8 @@
 
 
 #ifdef TH_TYPE_I16
-typedef unsigned TH_TYPE_I16 uint16_t;    /* 16 bits, unsigned == 2 BYTEs */
-typedef signed TH_TYPE_I16 int16_t;    /* 16 bits, signed */
+typedef unsigned TH_TYPE_I16 uint16_t;    // 16 bits, unsigned == 2 BYTEs
+typedef signed TH_TYPE_I16 int16_t;    // 16 bits, signed
 #else
 #ifndef HAVE_INT_TYPES
 typedef unsigned short int uint16_t;
@@ -57,8 +57,8 @@
 #endif
 
 #ifdef TH_TYPE_I32
-typedef unsigned TH_TYPE_I32 uint32_t;    /* 32 bits, unsigned == 4 BYTES == 2 WORDs */
-typedef signed TH_TYPE_I32 int32_t;    /* 32 bits, signed */
+typedef unsigned TH_TYPE_I32 uint32_t;    // 32 bits, unsigned == 4 BYTES == 2 WORDs
+typedef signed TH_TYPE_I32 int32_t;    // 32 bits, signed
 #else
 #ifndef HAVE_INT_TYPES
 typedef unsigned int uint32_t;
@@ -67,8 +67,8 @@
 #endif
 
 #ifdef TH_TYPE_I64
-typedef unsigned TH_TYPE_I64 uint64_t;    /* 64 bits, unsigned == 8 BYTES == 2 DWORDs */
-typedef signed TH_TYPE_I64 int64_t;    /* 64 bits, signed */
+typedef unsigned TH_TYPE_I64 uint64_t;    // 64 bits, unsigned == 8 BYTES == 2 DWORDs
+typedef signed TH_TYPE_I64 int64_t;    // 64 bits, signed
 #else
 #ifndef HAVE_INT_TYPES
 typedef unsigned long long uint64_t;
@@ -101,4 +101,4 @@
 #endif
 #endif
 
-#endif /* _TH_TYPES_H */
+#endif // _TH_TYPES_H
--- a/th_util.c	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_util.c	Sun Jun 22 07:23:54 2014 +0300
@@ -338,7 +338,7 @@
 {
     if (node == *list)
     {
-        /* First node in list */
+        // First node in list
         qlist_t *tmp = (*list)->next;
         if (tmp != NULL)
         {
@@ -349,14 +349,14 @@
     }
     else
     {
-        /* Somewhere in middle or end */
+        // Somewhere in middle or end
         if (node->prev != NULL)
             node->prev->next = node->next;
 
         if (node->next != NULL)
             node->next->prev = node->prev;
         else
-            (*list)->prev = node; /* Last node */
+            (*list)->prev = node; // Last node
 
         (*list)->num--;
     }
--- a/th_util.h	Sun Jun 22 07:06:46 2014 +0300
+++ b/th_util.h	Sun Jun 22 07:23:54 2014 +0300
@@ -51,7 +51,7 @@
 // Replacement for assert()
 #ifdef HAVE_NO_ASSERT
 #  ifdef NDEBUG
-#    define assert(NEXPR) /* stub */
+#    define assert(NEXPR) // stub
 #  else
 #    define assert(NEXPR) do { if (!(NEXPR)) { fprintf(stderr, "[%s:%d] assert(" # NEXPR ") failed!\n", __FILE__, __LINE__); abort(); } } while (0)
 #  endif
@@ -229,4 +229,4 @@
 #ifdef __cplusplus
 }
 #endif
-#endif /* TH_UTIL_H */
+#endif // TH_UTIL_H