summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-05-20 10:44:52 +0200
committerSimon Josefsson <simon@josefsson.org>2009-05-20 10:44:52 +0200
commit2f1b3d3bc5bf1164dae04b450ab99997d4ed3cc6 (patch)
treef7a398e3b27e3175991f387ce08b8eb296e48db4 /src
parent231d76e24fa5cc0f84e71f642573b50e99887f4f (diff)
downloadlibtasn1-2f1b3d3bc5bf1164dae04b450ab99997d4ed3cc6.tar.gz
libtasn1-2f1b3d3bc5bf1164dae04b450ab99997d4ed3cc6.tar.bz2
libtasn1-2f1b3d3bc5bf1164dae04b450ab99997d4ed3cc6.zip
Fix syntax-check problems.
Diffstat (limited to 'src')
-rw-r--r--src/asn1Coding.c26
-rw-r--r--src/asn1Decoding.c2
-rw-r--r--src/asn1Parser.c32
3 files changed, 21 insertions, 39 deletions
diff --git a/src/asn1Coding.c b/src/asn1Coding.c
index b084cb3..3012927 100644
--- a/src/asn1Coding.c
+++ b/src/asn1Coding.c
@@ -116,7 +116,7 @@ createFileName (char *inputFileName, char **outputFileName)
int
main (int argc, char *argv[])
{
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{"check", no_argument, 0, 'c'},
@@ -159,15 +159,13 @@ main (int argc, char *argv[])
case 'h': /* HELP */
printf ("%s\n", help_man);
- if (outputFileName)
- free (outputFileName);
+ free (outputFileName);
exit (0);
break;
case 'v': /* VERSION */
version_etc (stdout, program_name, PACKAGE, VERSION,
"Fabio Fiorina", NULL);
- if (outputFileName)
- free (outputFileName);
+ free (outputFileName);
exit (0);
break;
case 'c': /* CHECK SYNTAX */
@@ -183,8 +181,7 @@ main (int argc, char *argv[])
argv[optind - 1]);
printf ("%s\n", help_man);
- if (outputFileName)
- free (outputFileName);
+ free (outputFileName);
exit (1);
break;
default:
@@ -202,8 +199,7 @@ main (int argc, char *argv[])
" input file with assignments missing.\n\n");
printf ("%s\n", help_man);
- if (outputFileName)
- free (outputFileName);
+ free (outputFileName);
exit (1);
}
@@ -213,8 +209,7 @@ main (int argc, char *argv[])
"asn1Coding: input file with assignments missing.\n\n");
printf ("%s\n", help_man);
- if (outputFileName)
- free (outputFileName);
+ free (outputFileName);
exit (1);
}
@@ -308,8 +303,7 @@ main (int argc, char *argv[])
{
printf ("asn1Coding: %s\n", errorDescription);
- if (der)
- free (der);
+ free (der);
asn1_delete_structure (&definitions);
asn1_delete_structure (&structure);
@@ -340,8 +334,7 @@ main (int argc, char *argv[])
if (outputFile == NULL)
{
printf ("asn1Coding: output file '%s' not available\n", outputFileName);
- if (der)
- free (der);
+ free (der);
free (inputFileAsnName);
free (inputFileAssignmentName);
free (outputFileName);
@@ -353,8 +346,7 @@ main (int argc, char *argv[])
fclose (outputFile);
printf ("\nWriting: done.\n");
- if (der)
- free (der);
+ free (der);
free (inputFileAsnName);
free (inputFileAssignmentName);
diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c
index 8aebfc1..3fd9c67 100644
--- a/src/asn1Decoding.c
+++ b/src/asn1Decoding.c
@@ -57,7 +57,7 @@ static const char help_man[] =
int
main (int argc, char *argv[])
{
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{"check", no_argument, 0, 'c'},
diff --git a/src/asn1Parser.c b/src/asn1Parser.c
index 7e4d18e..8a09209 100644
--- a/src/asn1Parser.c
+++ b/src/asn1Parser.c
@@ -59,7 +59,7 @@ static const char help_man[] =
int
main (int argc, char *argv[])
{
- static struct option long_options[] = {
+ static const struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{"check", no_argument, 0, 'c'},
@@ -101,19 +101,15 @@ main (int argc, char *argv[])
case 'h': /* HELP */
printf ("%s\n", help_man);
- if (outputFileName)
- free (outputFileName);
- if (vectorName)
- free (vectorName);
+ free (outputFileName);
+ free (vectorName);
exit (0);
break;
case 'v': /* VERSION */
version_etc (stdout, program_name, PACKAGE, VERSION,
"Fabio Fiorina", NULL);
- if (outputFileName)
- free (outputFileName);
- if (vectorName)
- free (vectorName);
+ free (outputFileName);
+ free (vectorName);
exit (0);
break;
case 'c': /* CHECK SYNTAX */
@@ -133,10 +129,8 @@ main (int argc, char *argv[])
argv[optind - 1]);
printf ("%s\n", help_man);
- if (outputFileName)
- free (outputFileName);
- if (vectorName)
- free (vectorName);
+ free (outputFileName);
+ free (vectorName);
exit (1);
break;
default:
@@ -152,10 +146,8 @@ main (int argc, char *argv[])
fprintf (stderr, "asn1Parser: input file name missing.\n\n");
printf ("%s\n", help_man);
- if (outputFileName)
- free (outputFileName);
- if (vectorName)
- free (vectorName);
+ free (outputFileName);
+ free (vectorName);
exit (1);
}
else
@@ -194,10 +186,8 @@ main (int argc, char *argv[])
free (inputFileName);
- if (outputFileName)
- free (outputFileName);
- if (vectorName)
- free (vectorName);
+ free (outputFileName);
+ free (vectorName);
if (parse_result != ASN1_SUCCESS)
exit (1);