diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-01-02 23:17:04 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-01-05 21:44:12 +0100 |
commit | 925f58992064b41019c24fa012fa4cd88eb513fd (patch) | |
tree | f0a90e17f807f625c6e08ef4990e82f57e01d857 /nx-X11/programs/Xserver/hw | |
parent | ee3afe303fc35b98e5f674efc91fdeb2183dfcb5 (diff) | |
download | nx-libs-925f58992064b41019c24fa012fa4cd88eb513fd.tar.gz nx-libs-925f58992064b41019c24fa012fa4cd88eb513fd.tar.bz2 nx-libs-925f58992064b41019c24fa012fa4cd88eb513fd.zip |
Args.c: do not parse nx/nx marker as option
slight optimization
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Args.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 1bfec1798..155f40f66 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -1528,6 +1528,30 @@ static void nxagentParseOptionString(char *string) SAFE_free(dup); } +char *nxagentSkipNXMarker(char *string) +{ + if (strncasecmp(string, "nx/nx,", 6) == 0 || + strncasecmp(string, "nx/nx:", 6) == 0) + { + #ifdef DEBUG + fprintf(stderr, "%s: skipping [%6.6s]\n", __func__, string); + #endif + return string + 6; + } + else if (strncasecmp(string, "nx,", 3) == 0 || + strncasecmp(string, "nx:", 3) == 0) + { + #ifdef DEBUG + fprintf(stderr, "%s: skipping [%3.3s]\n", __func__, string); + #endif + return string + 3; + } + else + { + return string; + } +} + void nxagentProcessOptions(char * string) { if (!string) @@ -1540,15 +1564,10 @@ void nxagentProcessOptions(char * string) /* if the "filename" starts with an nx marker treat it as an option _string_ instead of a filename */ - if (strncasecmp(string, "nx/nx,", 6) == 0 || - strncasecmp(string, "nx/nx:", 6) == 0) + char *skipped = nxagentSkipNXMarker(string); + if (skipped != string) { - nxagentParseOptionString(string + 6); - } - else if (strncasecmp(string, "nx,", 3) == 0 || - strncasecmp(string, "nx:", 3) == 0) - { - nxagentParseOptionString(string + 3); + nxagentParseOptionString(skipped); } else { @@ -1659,7 +1678,11 @@ void nxagentProcessOptionsFile(char * filename) data[offset] = '\0'; - nxagentParseOptionString(data); + #ifdef DEBUG + fprintf(stderr, "%s: first line of options file [%s]\n", __func__, data); + #endif + + nxagentParseOptionString(nxagentSkipNXMarker(data)); nxagentProcessOptionsFileExit: |