Răsfoiți Sursa

Merge pull request #52 from fperrad/lint_20150413

Lint 20150413
Troy D. Hanson 10 ani în urmă
părinte
comite
44c9db59cd
2 a modificat fișierele cu 5 adăugiri și 5 ștergeri
  1. 2 2
      src/utarray.h
  2. 3 3
      src/utstring.h

+ 2 - 2
src/utarray.h

@@ -85,8 +85,8 @@ typedef struct {
 } while(0)
 
 #define utarray_reserve(a,by) do {                                            \
-  if (((a)->i+by) > ((a)->n)) {                                               \
-    while(((a)->i+by) > ((a)->n)) { (a)->n = ((a)->n ? (2*(a)->n) : 8); }     \
+  if (((a)->i+(by)) > ((a)->n)) {                                             \
+    while(((a)->i+(by)) > ((a)->n)) { (a)->n = ((a)->n ? (2*(a)->n) : 8); }   \
     if ( ((a)->d=(char*)realloc((a)->d, (a)->n*(a)->icd.sz)) == NULL) oom();  \
   }                                                                           \
 } while(0)

+ 3 - 3
src/utstring.h

@@ -49,9 +49,9 @@ typedef struct {
 #define utstring_reserve(s,amt)                            \
 do {                                                       \
   if (((s)->n - (s)->i) < (size_t)(amt)) {                 \
-     (s)->d = (char*)realloc((s)->d, (s)->n + amt);        \
+     (s)->d = (char*)realloc((s)->d, (s)->n + (amt));      \
      if ((s)->d == NULL) oom();                            \
-     (s)->n += amt;                                        \
+     (s)->n += (amt);                                      \
   }                                                        \
 } while(0)
 
@@ -100,7 +100,7 @@ do {                                                       \
 do {                                                       \
   utstring_reserve((s),(l)+1);                               \
   if (l) memcpy(&(s)->d[(s)->i], b, l);                    \
-  (s)->i += l;                                               \
+  (s)->i += (l);                                           \
   (s)->d[(s)->i]='\0';                                         \
 } while(0)