]> rtime.felk.cvut.cz Git - ulut.git/commitdiff
uLUt: ul_dbuff replace old years unused vca_log to ul_log when debugging is enabled.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 17 Oct 2015 16:43:47 +0000 (18:43 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 17 Oct 2015 16:43:47 +0000 (18:43 +0200)
The code debugging has not been used/required for years
so left vca_log lines has not beet spotted.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
ulut/ul_dbufmore.c

index 34b8fc92e8f6c089cc05f6674b8ee4c6bd81f8b5..cc220a333b359c9c1904deb642e6cb91b3810248 100644 (file)
 #include "ul_utmalloc.h"
 #include "ul_dbuff.h"
 
+#ifdef UL_DBUFF_LOGGING
+#include "ul_log.h"
+extern UL_LOG_CUST(ulogd_dbuff)
+#endif /*UL_DBUFF_LOGGING*/
+
 typedef unsigned char byte;
 
 //#undef DEBUG
@@ -83,7 +88,7 @@ int ul_dbuff_set_capacity(ul_dbuff_t *buf, int new_capacity)
                 else {
                     /* Old data are not changed if realloc fails, capacity remains at old value */
                     #ifdef UL_DBUFF_LOGGING
-                    vca_log("dbuff", LOG_DEB, "realloc buffer to %d failed\n", new_capacity);
+                    ul_logdeb("realloc buffer to %d failed\n", new_capacity);
                     #endif
                 }
             }
@@ -91,7 +96,7 @@ int ul_dbuff_set_capacity(ul_dbuff_t *buf, int new_capacity)
     }
     if(buf->len > buf->capacity) buf->len = buf->capacity;
     #ifdef UL_DBUFF_LOGGING
-    vca_log("dbuff", LOG_DEB, "capacity changed from %d to %ld, required %d\n", old_capacity, buf->capacity, new_capacity);
+    ul_logdeb("capacity changed from %d to %ld, required %d\n", old_capacity, buf->capacity, new_capacity);
     #endif
     return buf->capacity;
 }                                                                               
@@ -166,12 +171,11 @@ int ul_dbuff_cat(ul_dbuff_t *buf, const void *b, int n)
     if(b == NULL) return 0;
     if(new_len == ul_dbuff_set_len(buf, new_len)) {
         memcpy(buf->data + old_len, b, n);
+    } else {
+       #ifdef UL_DBUFF_LOGGING
+        ul_logdeb("ul_dbuff_cat: set_len(%lu) error, old_len == %lu\n, act len == %lu\n", new_len, old_len, buf->len);
+       #endif
     }
-    #ifdef UL_DBUFF_LOGGING
-    else {
-        vca_log("dbuff", LOG_DEB, "ul_dbuff_cat: set_len(%lu) error, old_len == %lu\n, act len == %lu\n", new_len, old_len, buf->len);
-    }
-    #endif
     return buf->len;
 }
 
@@ -186,26 +190,26 @@ inline int ul_dbuff_strcat(ul_dbuff_t *buf, const char *str)
 {
     /*
     #ifdef UL_DBUFF_LOGGING
-    if(buf->len > 0) vca_log("dbuff", LOG_DEB, "ul_dbuff_strcat: '%s' + '%s'\n", buf->data, str);
-    else vca_log("dbuff", LOG_DEB, "ul_dbuff_strcat: '' + %s\n", str);
+    if(buf->len > 0) ul_logdeb("ul_dbuff_strcat: '%s' + '%s'\n", buf->data, str);
+    else ul_logdeb("ul_dbuff_strcat: '' + %s\n", str);
     #endif
     */
     if(str == NULL) return 0;
     if(buf->len > 0 && buf->data[buf->len-1] == '\0') { 
         /* #ifdef UL_DBUFF_LOGGING
-        vca_log("dbuff", LOG_DEB, "ul_dbuff_strcat: terminating zero found at %ld, after '%c'\n", buf->len-1, buf->data[buf->len - 2]);
+        ul_logdeb("ul_dbuff_strcat: terminating zero found at %ld, after '%c'\n", buf->len-1, buf->data[buf->len - 2]);
         #endif
         */
         ul_dbuff_set_len(buf, buf->len - 1);
     }
     #ifdef UL_DBUFF_LOGGING
     if(buf->len > 0 && buf->data[buf->len-1] != '\0') {
-        vca_log("dbuff", LOG_ERR, "ul_dbuff_strcat: terminating zero not found at %ld, found '%c'\n", buf->len-1, buf->data[buf->len-1]);
+        ul_logerr("ul_dbuff_strcat: terminating zero not found at %ld, found '%c'\n", buf->len-1, buf->data[buf->len-1]);
     }
     #endif
     /* #ifdef UL_DBUFF_LOGGING
     ul_dbuff_cat(buf, str, strlen(str) + 1);
-    vca_log("dbuff", LOG_DEB, "ul_dbuff_strcat: returning '%s'\n", buf->data);
+    ul_logdeb("ul_dbuff_strcat: returning '%s'\n", buf->data);
     return buf->len;
     #else
     return ul_dbuff_cat(buf, str, strlen(str) + 1);