(_asn1_create_static_structure): Write NULL instead of 0. Indent output.
authorSimon Josefsson <simon@josefsson.org>
Fri, 1 Feb 2008 16:06:24 +0000 (17:06 +0100)
committerSimon Josefsson <simon@josefsson.org>
Fri, 1 Feb 2008 16:06:24 +0000 (17:06 +0100)
Reported by Michele Baldessari <michele@pupazzo.org>.

lib/structure.c

index 6eaa8ec..743e9ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *      Copyright (C) 2004, 2006, 2007 Free Software Foundation
+ *      Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation
  *      Copyright (C) 2002  Fabio Fiorina
  *
  * This file is part of LIBTASN1.
@@ -98,18 +98,18 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char *output_file_name,
 
   fprintf (file, "#include <libtasn1.h>\n\n");
 
-  fprintf (file, "extern const ASN1_ARRAY_TYPE %s[]={\n", vector_name);
+  fprintf (file, "const ASN1_ARRAY_TYPE %s[] = {\n", vector_name);
 
   p = pointer;
 
   while (p)
     {
-      fprintf (file, "  {");
+      fprintf (file, "  { ");
 
       if (p->name)
-       fprintf (file, "\"%s\",", p->name);
+       fprintf (file, "\"%s\", ", p->name);
       else
-       fprintf (file, "0,");
+       fprintf (file, "NULL, ");
 
       t = p->type;
       if (p->down)
@@ -117,12 +117,12 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char *output_file_name,
       if (p->right)
        t |= CONST_RIGHT;
 
-      fprintf (file, "%lu,", t);
+      fprintf (file, "%lu, ", t);
 
       if (p->value)
        fprintf (file, "\"%s\"},\n", p->value);
       else
-       fprintf (file, "0},\n");
+       fprintf (file, "NULL },\n");
 
       if (p->down)
        {
@@ -151,7 +151,7 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char *output_file_name,
        }
     }
 
-  fprintf (file, "  {0,0,0}\n};\n");
+  fprintf (file, "  { NULL, 0, NULL }\n};\n");
 
   fclose (file);