Explorar o código

useless global scope

Francois Perrad %!s(int64=10) %!d(string=hai) anos
pai
achega
27f9c16e1e
Modificáronse 16 ficheiros con 25 adicións e 33 borrados
  1. 1 2
      tests/test43.c
  2. 1 2
      tests/test50.c
  3. 1 2
      tests/test51.c
  4. 1 2
      tests/test52.c
  5. 2 3
      tests/test57.c
  6. 1 2
      tests/test59.c
  7. 1 2
      tests/test60.c
  8. 2 2
      tests/test63.c
  9. 2 2
      tests/test64.c
  10. 2 2
      tests/test68.c
  11. 2 2
      tests/test69.c
  12. 2 2
      tests/test70.c
  13. 2 2
      tests/test71.c
  14. 2 2
      tests/test72.c
  15. 2 2
      tests/test73.c
  16. 1 2
      tests/test78.c

+ 1 - 2
tests/test43.c

@@ -6,11 +6,10 @@ typedef struct {
     int b;
 } intpair_t;
 
-UT_icd pairicd = { sizeof(intpair_t),NULL,NULL,NULL};
-
 int main() {
   UT_array *pairs, *pairs_cpy;
   intpair_t it, *ip;
+  UT_icd pairicd = { sizeof(intpair_t),NULL,NULL,NULL};
   size_t zero=0;
   utarray_new(pairs, &pairicd);
   printf("length is %d\n", utarray_len(pairs));

+ 1 - 2
tests/test50.c

@@ -1,11 +1,10 @@
 #include <stdio.h>
 #include "utarray.h"
 
-UT_icd long_icd = {sizeof(long), NULL, NULL, NULL };
-
 int main() {
   UT_array *nums;
   long l, *p;
+  UT_icd long_icd = {sizeof(long), NULL, NULL, NULL };
   utarray_new(nums, &long_icd);
 
   l=1; utarray_push_back(nums, &l);

+ 1 - 2
tests/test51.c

@@ -6,12 +6,11 @@ typedef struct {
     int b;
 } intpair_t;
 
-UT_icd intpair_icd = {sizeof(intpair_t), NULL, NULL, NULL};
-
 int main() {
 
   UT_array *pairs;
   intpair_t ip, *p;
+  UT_icd intpair_icd = {sizeof(intpair_t), NULL, NULL, NULL};
   utarray_new(pairs,&intpair_icd);
 
   ip.a=1;  ip.b=2;  utarray_push_back(pairs, &ip);

+ 1 - 2
tests/test52.c

@@ -18,11 +18,10 @@ static void intchar_dtor(void *_elt) {
   if (elt->s != NULL) free(elt->s);
 }
 
-UT_icd intchar_icd = {sizeof(intchar_t), NULL, intchar_copy, intchar_dtor};
-
 int main() {
   UT_array *intchars;
   intchar_t ic, *p;
+  UT_icd intchar_icd = {sizeof(intchar_t), NULL, intchar_copy, intchar_dtor};
   utarray_new(intchars, &intchar_icd);
 
   ic.a=1; ic.s="hello"; utarray_push_back(intchars, &ic);

+ 2 - 3
tests/test57.c

@@ -8,11 +8,10 @@ typedef struct {
   UT_hash_handle hh;
 } el_t;
 
-el_t *hash = NULL;
-char *someaddr = NULL;
-
 int main() {
   el_t *d;
+  el_t *hash = NULL;
+  char *someaddr = NULL;
   el_t *e = (el_t*)malloc(sizeof(el_t));
   if (!e) return -1;
   e->key = (void*)someaddr;

+ 1 - 2
tests/test59.c

@@ -11,10 +11,9 @@ typedef struct item {
   UT_hash_handle hh;
 } item_t;
 
-item_t *items=NULL;
-
 int main(int argc, char *argvp[]) {
   item_t *item1, *item2, *tmp1, *tmp2;
+  item_t *items=NULL;
 
   /* make initial element */
   item_t *i = malloc(sizeof(*i));

+ 1 - 2
tests/test60.c

@@ -11,10 +11,9 @@ typedef struct item {
   UT_hash_handle hh;
 } item_t;
 
-item_t *items=NULL;
-
 int main(int argc, char *argvp[]) {
   item_t *item1, *item2, *tmp1, *tmp2;
+  item_t *items=NULL;
 
   /* make initial element */
   item_t *i = malloc(sizeof(*i));

+ 2 - 2
tests/test63.c

@@ -6,11 +6,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA = NULL, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[10], *e;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<10;i++) els[i].id='a'+i;
 
     /* test LL macros */

+ 2 - 2
tests/test64.c

@@ -6,11 +6,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA = NULL, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[10], *e;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<10;i++) els[i].id='a'+i;
 
     /* test DL macros */

+ 2 - 2
tests/test68.c

@@ -7,11 +7,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[20], *e, *tmp;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<20;i++) els[i].id='a'+i;
 
     /* test DL macros */

+ 2 - 2
tests/test69.c

@@ -7,11 +7,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[26], *e, *tmp;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<25;i++) els[i].id='a'+i;
 
     /* test DL macros */

+ 2 - 2
tests/test70.c

@@ -7,11 +7,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[20], *e, *tmp;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<20;i++) els[i].id='a'+i;
 
     /* test LL macros */

+ 2 - 2
tests/test71.c

@@ -7,11 +7,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[26], *e, *tmp;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<25;i++) els[i].id='a'+i;
 
     /* test LL macros */

+ 2 - 2
tests/test72.c

@@ -7,11 +7,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[20], *e, *tmp, *tmp2;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<20;i++) els[i].id='a'+i;
 
     /* test CDL macros */

+ 2 - 2
tests/test73.c

@@ -7,11 +7,11 @@ typedef struct el {
     struct el *next, *prev;
 } el;
 
-el *headA, *headB = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[26], *e, *tmp, *tmp2;
+    el *headA = NULL;
+    el *headB = NULL;
     for(i=0;i<25;i++) els[i].id='a'+i;
 
     /* test CDL macros */

+ 1 - 2
tests/test78.c

@@ -6,11 +6,10 @@ typedef struct el {
     struct el *Next, *Prev;
 } el;
 
-el *head = NULL;
-
 int main(int argc, char *argv[]) {
     int i;
     el els[10], *e;
+    el *head = NULL;
     for(i=0;i<10;i++) els[i].id='a'+i;
 
     /* test CDL macros */