Skip to content

Commit

Permalink
- minor (static and const) fixes
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15276 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Feb 22, 2013
1 parent 3492485 commit 2405061
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions SimulationRuntime/c/simulation/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@
#include <string.h>
#include <stdio.h>

int flagSet(const char*, int, char**); /* -f */
int optionSet(const char *option, int argc, char** argv); /* -f=value */
const char* getOption(const char*, int, char **); /* -f=value; returns NULL if not found */
const char* getFlagValue(const char *, int , char **); /* -f value; returns NULL if not found */
static int flagSet(const char*, int, char**); /* -f */
static int optionSet(const char *option, int argc, char** argv); /* -f=value */
static const char* getOption(const char*, int, char **); /* -f=value; returns NULL if not found */
static const char* getFlagValue(const char *, int , char **); /* -f value; returns NULL if not found */

int omc_flag[FLAG_MAX];
char *omc_flagValue[FLAG_MAX];
const char *omc_flagValue[FLAG_MAX];

int helpFlagSet(int argc, char** argv)
{
return flagSet("?", argc, argv) || flagSet("help", argc, argv);
}

int checkCommandLineArguments(int argc, char **argv)
{
Expand Down Expand Up @@ -144,7 +149,7 @@ int checkCommandLineArguments(int argc, char **argv)
return 0;
}

int flagSet(const char *option, int argc, char** argv)
static int flagSet(const char *option, int argc, char** argv)
{
int i;
for(i=0; i<argc; i++)
Expand All @@ -155,18 +160,13 @@ int flagSet(const char *option, int argc, char** argv)
return 0;
}

int helpFlagSet(int argc, char** argv)
{
return flagSet("?", argc, argv) || flagSet("help", argc, argv);
}

int optionSet(const char *option, int argc, char** argv)
static int optionSet(const char *option, int argc, char** argv)
{
return getOption(option, argc, argv) != NULL;
}

/* returns the value of a flag on the form -flagname=value */
const char* getOption(const char *option, int argc, char **argv)
static const char* getOption(const char *option, int argc, char **argv)
{
int optLen = strlen(option), i;
for(i=0; i<argc; i++)
Expand All @@ -178,7 +178,7 @@ const char* getOption(const char *option, int argc, char **argv)
}

/* returns the value of a flag on the form -flagname value */
const char* getFlagValue(const char *option, int argc, char **argv)
static const char* getFlagValue(const char *option, int argc, char **argv)
{
int i;
for(i=0; i<argc; i++)
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/simulation/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#endif

extern int omc_flag[FLAG_MAX];
extern char *omc_flagValue[FLAG_MAX];
extern const char *omc_flagValue[FLAG_MAX];

int helpFlagSet(int argc, char** argv);
int checkCommandLineArguments(int argc, char **argv);
Expand Down

0 comments on commit 2405061

Please sign in to comment.