aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-11-18 22:32:21 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-11-18 23:55:02 +0100
commit4ef4fbf16eca01b40176a830bfa6a8ada95e357b (patch)
tree925afe265c0f0a5a36b215e5bf68e6fe1c2e3bdf /nx-X11/programs
parent6c9622963e156ead83e49ac4df5c227dc07ce00c (diff)
downloadnx-libs-4ef4fbf16eca01b40176a830bfa6a8ada95e357b.tar.gz
nx-libs-4ef4fbf16eca01b40176a830bfa6a8ada95e357b.tar.bz2
nx-libs-4ef4fbf16eca01b40176a830bfa6a8ada95e357b.zip
Args.c: simplify nxagentProcessOptionsFile()
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 72926fd60..2b8d44388 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -1592,8 +1592,8 @@ void nxagentProcessOptions(char * string)
void nxagentProcessOptionsFile(char * filename)
{
- FILE *file;
- char *data;
+ FILE *file = NULL;
+ char *data = NULL;
int offset;
int size;
@@ -1629,7 +1629,7 @@ void nxagentProcessOptionsFile(char * filename)
fprintf(stderr, "Warning: Couldn't position inside option file '%s'. Error is '%s'.\n",
validateString(filename), strerror(errno));
- goto nxagentProcessOptionsFileClose;
+ goto nxagentProcessOptionsFileExit;
}
if ((sizeOfFile = ftell(file)) == -1)
@@ -1637,7 +1637,7 @@ void nxagentProcessOptionsFile(char * filename)
fprintf(stderr, "Warning: Couldn't get the size of option file '%s'. Error is '%s'.\n",
validateString(filename), strerror(errno));
- goto nxagentProcessOptionsFileClose;
+ goto nxagentProcessOptionsFileExit;
}
#ifdef DEBUG
@@ -1652,7 +1652,7 @@ void nxagentProcessOptionsFile(char * filename)
fprintf(stderr, "Warning: Maximum file size exceeded for options '%s'.\n",
validateString(filename));
- goto nxagentProcessOptionsFileClose;
+ goto nxagentProcessOptionsFileExit;
}
if ((data = malloc(sizeOfFile + 1)) == NULL)
@@ -1660,7 +1660,7 @@ void nxagentProcessOptionsFile(char * filename)
fprintf(stderr, "Warning: Memory allocation failed processing file '%s'.\n",
validateString(filename));
- goto nxagentProcessOptionsFileClose;
+ goto nxagentProcessOptionsFileExit;
}
offset = 0;
@@ -1675,7 +1675,7 @@ void nxagentProcessOptionsFile(char * filename)
fprintf(stderr, "Warning: Error reading the option file '%s'.\n",
validateString(filename));
- goto nxagentProcessOptionsFileFree;
+ goto nxagentProcessOptionsFileExit;
}
size += result;
@@ -1692,7 +1692,7 @@ void nxagentProcessOptionsFile(char * filename)
fprintf(stderr, "Warning: Premature end of option file '%s' while reading.\n",
validateString(filename));
- goto nxagentProcessOptionsFileFree;
+ goto nxagentProcessOptionsFileExit;
}
/*
@@ -1705,23 +1705,19 @@ void nxagentProcessOptionsFile(char * filename)
nxagentParseOptionString(data);
-nxagentProcessOptionsFileFree:
-
- if (data != NULL)
- {
- free(data);
- }
+nxagentProcessOptionsFileExit:
-nxagentProcessOptionsFileClose:
+ free(data);
- if (fclose(file) != 0)
+ if (file)
{
- fprintf(stderr, "Warning: Couldn't close option file '%s'. Error is '%s'.\n",
- validateString(filename), strerror(errno));
+ if (fclose(file) != 0)
+ {
+ fprintf(stderr, "Warning: Couldn't close option file '%s'. Error is '%s'.\n",
+ validateString(filename), strerror(errno));
+ }
}
-nxagentProcessOptionsFileExit:
-
return;
}