]> rtime.felk.cvut.cz Git - ulut.git/commitdiff
Minor uLUt enhancements for C89 conformance from other projects.
authorppisa <ppisa>
Sat, 4 Nov 2006 09:15:19 +0000 (09:15 +0000)
committerppisa <ppisa>
Sat, 4 Nov 2006 09:15:19 +0000 (09:15 +0000)
ulut/ul_dbufbase.c
ulut/ul_dbufflog.c
ulut/ul_dbufflog.h
ulut/ul_dbufmore.c

index 6600cf7efa3d95ad688a20a3142eb68f82b835a8..ab9b96174e9f6fa8c45b263be52d8bbaa149acbc 100644 (file)
@@ -27,7 +27,6 @@
 
 typedef unsigned char byte;
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_init - init memory allocated for dynamic buffer 
  * @buf: buffer structure
@@ -46,7 +45,6 @@ int ul_dbuff_init(ul_dbuff_t *buf, int flags)
     return buf->capacity;
 }                                                                               
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_destroy - frees all resources allocated by buf 
  * @buf: buffer structure
@@ -56,7 +54,6 @@ void ul_dbuff_destroy(ul_dbuff_t *buf)
     ul_dbuff_prep(buf, 0);
 }
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_prep - sets a new len and capacity of the buffer
  * @buf: buffer structure
index 848ae7d26b61d04d8b32a9f638a05bd613cd7315..068e0922482be50d548ffc129e6d45a7a7e2ae26 100644 (file)
@@ -5,8 +5,8 @@ ul_log_domain_t ulogd_dbuff;
 
 void ul_dbuff_log_hex(ul_dbuff_t *buf, int log_level)
 {
-    ul_log(&ulogd_dbuff, log_level, "len=%li capacity=%li\n", buf->len, buf->capacity);
     int i;
+    ul_log(&ulogd_dbuff, log_level, "len=%li capacity=%li\n", buf->len, buf->capacity);
     log_level |= UL_LOGL_CONT;
     for(i=0; i<buf->len; i++) {
         char c = buf->data[i];
index 436e8d597e00ca9957b47b2544ac0d9e7977d6f5..256e031e05344872c363020345c100e8729ea574 100644 (file)
@@ -10,5 +10,5 @@
  */
 void ul_dbuff_log_hex(ul_dbuff_t *buf, int log_level);
 
-#endif // UL_DBUFFLOG_H
+#endif /* UL_DBUFFLOG_H */
 
index f9b9b26bb4f74b7fcd9fcf76322a722d3cdb2eda..cb0ecb200252dddf8fc558565b214390285cfa20 100644 (file)
@@ -29,7 +29,6 @@ typedef unsigned char byte;
 
 //#undef DEBUG
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_set_capacity - change capacity of buffer to at least @new_capacity
  * @buf: buffer structure
@@ -97,7 +96,6 @@ int ul_dbuff_set_capacity(ul_dbuff_t *buf, int new_capacity)
     return buf->capacity;
 }                                                                               
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_set_len - sets a new len of the buffer, change the capacity if neccessary 
  * @buf: buffer structure
@@ -122,7 +120,6 @@ int ul_dbuff_set_len(ul_dbuff_t *buf, int new_len)
     return buf->len;
 }
  
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_cpy - copies bytes to buffer and change its capacity if neccessary like memset
  * @buf: buffer structure
@@ -138,7 +135,6 @@ int ul_dbuff_set(ul_dbuff_t *buf, byte b, int n)
     return buf->len;
 }
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_cpy - copies bytes to buffer and change its capacity if neccessary 
  * @buf: buffer structure
@@ -155,7 +151,6 @@ int ul_dbuff_cpy(ul_dbuff_t *buf, const void *b, int n)
     return buf->len;
 }
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_cat - appends bytes at end of buffer and change its capacity if neccessary 
  * @buf: buffer structure
@@ -180,7 +175,6 @@ int ul_dbuff_cat(ul_dbuff_t *buf, const void *b, int n)
     return buf->len;
 }
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_strcat - appends str at dhe end of buffer and change its capacity if neccessary 
  * @buf: buffer structure
@@ -219,7 +213,6 @@ inline int ul_dbuff_strcat(ul_dbuff_t *buf, const char *str)
     return ul_dbuff_cat(buf, str, strlen(str) + 1);
 }
  
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_strcpy - copy str to the buffer and change its capacity if neccessary 
  * @buf: buffer structure
@@ -233,7 +226,6 @@ inline int ul_dbuff_strcpy(ul_dbuff_t *buf, const char *str)
     return ul_dbuff_strcat(buf, str);
 }
  
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_append_byte - appends byte at dhe end of buffer and change its capacity if neccessary 
  * @buf: buffer structure
@@ -246,7 +238,6 @@ inline int ul_dbuff_append_byte(ul_dbuff_t *buf, unsigned char b)
     return ul_dbuff_cat(buf, &b, 1);
 }
  
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_ltrim - remove all white space characters from the left 
  * @buf: buffer structure
@@ -265,7 +256,6 @@ int ul_dbuff_ltrim(ul_dbuff_t *buf)
        return buf->len;
 }
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_rtrim - remove all white space characters from the right
  * @buf: buffer structure
@@ -292,7 +282,6 @@ int ul_dbuff_rtrim(ul_dbuff_t *buf)
        return buf->len;
 }
 
-//-----------------------------------------------------------------
 /**
  * ul_dbuff_trim - remove all white space characters from the right and from the left 
  * @buf: buffer structure
@@ -304,7 +293,7 @@ int ul_dbuff_trim(ul_dbuff_t *buf)
     ul_dbuff_rtrim(buf);
     return ul_dbuff_ltrim(buf);
 }
-//-----------------------------------------------------------------
+
 /**
  * ul_dbuff_cpos - searches string for char 
  * @buf:   searched dbuff
@@ -331,7 +320,7 @@ int ul_dbuff_cpos(const ul_dbuff_t *buf, unsigned char what, unsigned char quote
     if(ret >= buf->len) ret = -1;
     return ret;
 }
-//-----------------------------------------------------------------
+
 /**
  * ul_str_cpos - searches string for char 
  * @str:   zero terminated string
@@ -357,7 +346,7 @@ int ul_str_cpos(const unsigned char *str, unsigned char what, unsigned char quot
     if(!str[ret]) ret = -1;
     return ret;
 }
-//-----------------------------------------------------------------
+
 /**
  * ul_str_pos - searches string for substring
  * @str:   zero terminated string
@@ -384,7 +373,7 @@ int ul_str_pos(const unsigned char *str, const unsigned char *what, unsigned cha
     }
     return -1;
 }
-//-----------------------------------------------------------------
+
 /**
  * ul_str_ncpy - copies string to the buffer
  * @to:         buffer where to copy str
@@ -405,7 +394,7 @@ int ul_str_ncpy(unsigned char *to, const unsigned char *from, int buff_size)
     to[i] = '\0';
     return i;
 }
-//-----------------------------------------------------------------
+
 /**
  * ul_dbuff_cut_pos - cut first @n bytes from @fromdb and copies it to @todb.
  * If @n is greater than fromdb.len whole @fromdb is copied to @todb.
@@ -426,7 +415,7 @@ void ul_dbuff_cut_pos(ul_dbuff_t *fromdb, ul_dbuff_t *todb, int n)
     memmove(fromdb->data, fromdb->data + n, fromdb->len - n);
     ul_dbuff_set_len(fromdb, newlen);
 }
-//-----------------------------------------------------------------
+
 /**
  * ul_dbuff_cut - cuts bytes before delimiter + delimiter char from @fromdb and copies tham to the @todb
  * If @fromdb doesn't contain delimiter @todb is trimmed to zero length.
@@ -441,7 +430,7 @@ void ul_dbuff_cut_delimited(ul_dbuff_t *fromdb, ul_dbuff_t *todb, char delimiter
     if(pos < 0) pos = -1;
     ul_dbuff_cut_pos(fromdb, todb, pos+1);
 }
-//-----------------------------------------------------------------
+
 /**
  * ul_dbuff_cut_token - cuts not whitespaces from %fromdb to %todb.
  *                      Leading whitespaces are ignored. Cut string is trimmed.
@@ -452,12 +441,10 @@ void ul_dbuff_cut_token(ul_dbuff_t *fromdb, ul_dbuff_t *todb)
 {
     const unsigned char *pc = (unsigned char*)fromdb->data;
     int pos;
-    // skip leading white spaces
+    /* skip leading white spaces */
     for(pos=0; pc[pos]>0 && pc[pos]<=' ' && pos<fromdb->len; pos++);
-    // skip token
+    /* skip token */
     for(; pc[pos]>' ' && pos<fromdb->len; pos++);
     ul_dbuff_cut_pos(fromdb, todb, pos);
     ul_dbuff_trim(todb);
 }
-//-----------------------------------------------------------------
-