declare functions that are used only locally static
This commit is contained in:
+27
-15
@@ -44,12 +44,12 @@ static section *first_section = NULL;
|
|||||||
/* Yes there is a static. It's C after all :)*/
|
/* Yes there is a static. It's C after all :)*/
|
||||||
|
|
||||||
|
|
||||||
section *find_section(const char *sectionname);
|
static section *find_section(const char *sectionname);
|
||||||
section *add_section(const char *sectionname);
|
static section *add_section(const char *sectionname);
|
||||||
key *find_key(section *s, const char *keyname, int skip);
|
static key *find_key(section *s, const char *keyname, int skip);
|
||||||
key *add_key(section *s, const char *keyname, const char *value);
|
static key *add_key(section *s, const char *keyname, const char *value);
|
||||||
char get_next_char_f(FILE *f);
|
static char get_next_char_f(FILE *f);
|
||||||
int process_config(section **current_section, char(*get_next_char)(), char modify_section_allowed, const char *source_descr, FILE *f);
|
static int process_config(section **current_section, char(*get_next_char)(), const char *source_descr, FILE *f);
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_LDAP_SUPPORT
|
#ifdef WITH_LDAP_SUPPORT
|
||||||
@@ -115,7 +115,7 @@ int config_read_file(const char *filename)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_config(&curr_section, get_next_char_f, 1, filename, f);
|
process_config(&curr_section, get_next_char_f, filename, f);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
@@ -320,7 +320,8 @@ connect_to_ldap(void)
|
|||||||
#define BUFSIZE 255
|
#define BUFSIZE 255
|
||||||
#endif /* WITH_LDAP_SUPPORT */
|
#endif /* WITH_LDAP_SUPPORT */
|
||||||
|
|
||||||
section *find_section(const char *sectionname)
|
|
||||||
|
static section *find_section(const char *sectionname)
|
||||||
{
|
{
|
||||||
section *s;
|
section *s;
|
||||||
|
|
||||||
@@ -374,7 +375,8 @@ section *find_section(const char *sectionname)
|
|||||||
return NULL; /* not found */
|
return NULL; /* not found */
|
||||||
}
|
}
|
||||||
|
|
||||||
section *add_section(const char *sectionname)
|
|
||||||
|
static section *add_section(const char *sectionname)
|
||||||
{
|
{
|
||||||
section *s;
|
section *s;
|
||||||
section **place = &first_section;
|
section **place = &first_section;
|
||||||
@@ -392,7 +394,8 @@ section *add_section(const char *sectionname)
|
|||||||
return(*place);
|
return(*place);
|
||||||
}
|
}
|
||||||
|
|
||||||
key *find_key(section *s, const char *keyname, int skip)
|
|
||||||
|
static key *find_key(section *s, const char *keyname, int skip)
|
||||||
{
|
{
|
||||||
key *k;
|
key *k;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -516,7 +519,8 @@ key *find_key(section *s, const char *keyname, int skip)
|
|||||||
return NULL; /* not found*/
|
return NULL; /* not found*/
|
||||||
}
|
}
|
||||||
|
|
||||||
key *add_key(section *s, const char *keyname, const char *value)
|
|
||||||
|
static key *add_key(section *s, const char *keyname, const char *value)
|
||||||
{
|
{
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
key *k;
|
key *k;
|
||||||
@@ -537,7 +541,8 @@ key *add_key(section *s, const char *keyname, const char *value)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char get_next_char_f(FILE *f)
|
|
||||||
|
static char get_next_char_f(FILE *f)
|
||||||
{
|
{
|
||||||
int c = fgetc(f);
|
int c = fgetc(f);
|
||||||
|
|
||||||
@@ -565,8 +570,7 @@ char get_next_char_f(FILE *f)
|
|||||||
#define MAXVALUELENGTH 200
|
#define MAXVALUELENGTH 200
|
||||||
|
|
||||||
|
|
||||||
|
static int process_config(section **current_section, char(*get_next_char)(), const char *source_descr, FILE *f)
|
||||||
int process_config(section **current_section, char(*get_next_char)(), char modify_section_allowed, const char *source_descr, FILE *f)
|
|
||||||
{
|
{
|
||||||
char state = ST_INITIAL;
|
char state = ST_INITIAL;
|
||||||
char ch;
|
char ch;
|
||||||
@@ -813,7 +817,8 @@ int process_config(section **current_section, char(*get_next_char)(), char modif
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
#if CONFIGFILE_DEBUGTEST
|
||||||
void config_dump(void)
|
void config_dump(void)
|
||||||
{
|
{
|
||||||
section *s;
|
section *s;
|
||||||
@@ -829,4 +834,11 @@ section *s;
|
|||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc > 0)
|
||||||
|
config_read_file(argv[1]);
|
||||||
|
config_dump();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user