Skip to content

Commit d42d9ed

Browse files
committed
Remove popt API calls that are no longer necessary.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10187 4a71c877-e1ca-e34f-864e-861f7616d084 (cherry picked from commit bcb70cb) Conflicts: src/clparse.c
1 parent 2aca760 commit d42d9ed

1 file changed

Lines changed: 0 additions & 40 deletions

File tree

‎src/clparse.c‎

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ BOOL bAllowDebugMode = false;
4747
#define POPT_ARG_STRING true
4848
#define POPT_ARG_NONE false
4949
#define POPT_ERROR_BADOPT -1
50-
#define POPT_ARGFLAG_DOC_HIDDEN 0
5150

5251
struct poptOption
5352
{
@@ -69,11 +68,6 @@ typedef struct _poptContext
6968
const struct poptOption *table;
7069
} *poptContext;
7170

72-
static void poptPrintUsage(poptContext ctx, FILE *output, WZ_DECL_UNUSED int unused)
73-
{
74-
// TODO ?
75-
}
76-
7771
static void poptPrintHelp(poptContext ctx, FILE *output, WZ_DECL_UNUSED int unused)
7872
{
7973
int i;
@@ -107,11 +101,6 @@ static void poptPrintHelp(poptContext ctx, FILE *output, WZ_DECL_UNUSED int unus
107101
}
108102
}
109103

110-
static void poptFreeContext(WZ_DECL_UNUSED poptContext ctx)
111-
{
112-
// Nothing!
113-
}
114-
115104
static const char *poptBadOption(poptContext ctx, WZ_DECL_UNUSED int unused)
116105
{
117106
return ctx->bad;
@@ -222,7 +211,6 @@ typedef enum
222211
CLI_MOD_CA,
223212
CLI_MOD_MP,
224213
CLI_SAVEGAME,
225-
CLI_USAGE,
226214
CLI_WINDOW,
227215
CLI_VERSION,
228216
CLI_RESOLUTION,
@@ -256,8 +244,6 @@ static const struct poptOption* getOptionsTable(void)
256244
{ "noassert", '\0', POPT_ARG_NONE, NULL, CLI_NOASSERT, N_("Disable asserts"), NULL },
257245
{ "crash", '\0', POPT_ARG_NONE, NULL, CLI_CRASH, N_("Causes a crash to test the crash handler"), NULL },
258246
{ "savegame", '\0', POPT_ARG_STRING, NULL, CLI_SAVEGAME, N_("Load a saved game"), N_("savegame") },
259-
{ "usage", '\0', POPT_ARG_NONE
260-
| POPT_ARGFLAG_DOC_HIDDEN, NULL, CLI_USAGE, NULL, NULL, },
261247
{ "window", '\0', POPT_ARG_NONE, NULL, CLI_WINDOW, N_("Play in windowed mode"), NULL },
262248
{ "version", '\0', POPT_ARG_NONE, NULL, CLI_VERSION, N_("Show version information and exit"), NULL },
263249
{ "resolution", '\0', POPT_ARG_STRING, NULL, CLI_RESOLUTION, N_("Set the resolution to use"), N_("WIDTHxHEIGHT") },
@@ -336,15 +322,13 @@ bool ParseCommandLineEarly(int argc, const char** argv)
336322
if (token == NULL)
337323
{
338324
debug(LOG_FATAL, "Usage: --debug <flag>");
339-
poptFreeContext(poptCon);
340325
return false;
341326
}
342327

343328
// Attempt to enable the given debug section
344329
if (!debug_enable_switch(token))
345330
{
346331
debug(LOG_FATAL, "Debug flag \"%s\" not found!", token);
347-
poptFreeContext(poptCon);
348332
return false;
349333
}
350334
break;
@@ -355,7 +339,6 @@ bool ParseCommandLineEarly(int argc, const char** argv)
355339
if (token == NULL)
356340
{
357341
debug(LOG_FATAL, "Missing debugfile filename?");
358-
poptFreeContext(poptCon);
359342
return false;
360343
}
361344
debug_register_callback( debug_callback_file, debug_callback_file_init, debug_callback_file_exit, (void*)token );
@@ -373,34 +356,24 @@ bool ParseCommandLineEarly(int argc, const char** argv)
373356
if (token == NULL)
374357
{
375358
debug(LOG_FATAL, "Unrecognised configuration directory");
376-
poptFreeContext(poptCon);
377359
return false;
378360
}
379361
sstrcpy(configdir, token);
380362
break;
381363

382364
case CLI_HELP:
383365
poptPrintHelp(poptCon, stdout, 0);
384-
poptFreeContext(poptCon);
385-
return false;
386-
387-
case CLI_USAGE:
388-
poptPrintUsage(poptCon, stdout, 0);
389-
poptFreeContext(poptCon);
390366
return false;
391367

392368
case CLI_VERSION:
393369
printf("Warzone 2100 - %s\n", version_getFormattedVersionString());
394-
poptFreeContext(poptCon);
395370
return false;
396371

397372
default:
398373
break;
399374
};
400375
}
401376

402-
poptFreeContext(poptCon);
403-
404377
return true;
405378
}
406379

@@ -429,7 +402,6 @@ bool ParseCommandLine(int argc, const char** argv)
429402
case CLI_FLUSHDEBUGSTDERR:
430403
case CLI_CONFIGDIR:
431404
case CLI_HELP:
432-
case CLI_USAGE:
433405
case CLI_VERSION:
434406
// These options are parsed in ParseCommandLineEarly() already, so ignore them
435407
break;
@@ -457,7 +429,6 @@ bool ParseCommandLine(int argc, const char** argv)
457429
if (token == NULL)
458430
{
459431
debug(LOG_FATAL, "Unrecognised datadir");
460-
poptFreeContext(poptCon);
461432
return false;
462433
}
463434
sstrcpy(datadir, token);
@@ -472,7 +443,6 @@ bool ParseCommandLine(int argc, const char** argv)
472443
if (token == NULL)
473444
{
474445
debug(LOG_FATAL, "No IP/hostname given");
475-
poptFreeContext(poptCon);
476446
return false;
477447
}
478448
sstrcpy(iptoconnect, token);
@@ -487,7 +457,6 @@ bool ParseCommandLine(int argc, const char** argv)
487457
if (token == NULL)
488458
{
489459
debug(LOG_POPUP, "No game name");
490-
poptFreeContext(poptCon);
491460
return false;
492461
}
493462
if (strcmp(token, "CAM_1A") && strcmp(token, "CAM_2A") && strcmp(token, "CAM_3A")
@@ -521,7 +490,6 @@ bool ParseCommandLine(int argc, const char** argv)
521490
if (token == NULL)
522491
{
523492
debug(LOG_FATAL, "Missing mod name?");
524-
poptFreeContext(poptCon);
525493
return false;
526494
}
527495

@@ -530,7 +498,6 @@ bool ParseCommandLine(int argc, const char** argv)
530498
if (i >= 100 || global_mods[i] != NULL)
531499
{
532500
debug(LOG_FATAL, "Too many mods registered! Aborting!");
533-
poptFreeContext(poptCon);
534501
return false;
535502
}
536503
global_mods[i] = strdup(token);
@@ -545,7 +512,6 @@ bool ParseCommandLine(int argc, const char** argv)
545512
if (token == NULL)
546513
{
547514
debug(LOG_FATAL, "Missing mod name?");
548-
poptFreeContext(poptCon);
549515
return false;
550516
}
551517

@@ -554,7 +520,6 @@ bool ParseCommandLine(int argc, const char** argv)
554520
if (i >= 100 || campaign_mods[i] != NULL)
555521
{
556522
debug(LOG_FATAL, "Too many mods registered! Aborting!");
557-
poptFreeContext(poptCon);
558523
return false;
559524
}
560525
campaign_mods[i] = strdup(token);
@@ -569,15 +534,13 @@ bool ParseCommandLine(int argc, const char** argv)
569534
if (token == NULL)
570535
{
571536
debug(LOG_FATAL, "Missing mod name?");
572-
poptFreeContext(poptCon);
573537
return false;
574538
}
575539

576540
for (i = 0; i < 100 && multiplay_mods[i] != NULL; ++i);
577541
if (i >= 100 || multiplay_mods[i] != NULL)
578542
{
579543
debug(LOG_FATAL, "Too many mods registered! Aborting!");
580-
poptFreeContext(poptCon);
581544
return false;
582545
}
583546
multiplay_mods[i] = strdup(token);
@@ -615,7 +578,6 @@ bool ParseCommandLine(int argc, const char** argv)
615578
if (token == NULL)
616579
{
617580
debug(LOG_POPUP, "Unrecognised savegame name");
618-
poptFreeContext(poptCon);
619581
return false;
620582
}
621583
snprintf(saveGameName, sizeof(saveGameName), "%s/%s", SaveGamePath, token);
@@ -648,7 +610,5 @@ bool ParseCommandLine(int argc, const char** argv)
648610
};
649611
}
650612

651-
poptFreeContext(poptCon);
652-
653613
return true;
654614
}

0 commit comments

Comments
 (0)