Skip to content
Snippets Groups Projects
Commit 42d016f8 authored by rswindell's avatar rswindell
Browse files

Renamed MAX_VALUE_LEN macro to INI_MAX_VALUE_LEN.

Moved definition of MAX_LINE_LEN to ini_file.c, renamed to INI_*.
parent 64f6d65a
Branches
Tags
No related merge requests found
...@@ -448,7 +448,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva ...@@ -448,7 +448,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
char* section; char* section;
char* key; char* key;
char** list; char** list;
char buf[MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
int32 i; int32 i;
jsval val; jsval val;
jsval dflt=argv[2]; jsval dflt=argv[2];
......
...@@ -164,7 +164,7 @@ void sbbs_read_ini( ...@@ -164,7 +164,7 @@ void sbbs_read_ini(
char* ctrl_dir; char* ctrl_dir;
char* temp_dir; char* temp_dir;
char host_name[128]; char host_name[128];
char value[MAX_VALUE_LEN]; char value[INI_MAX_VALUE_LEN];
ulong interface_addr; ulong interface_addr;
ulong js_max_bytes; ulong js_max_bytes;
ushort sem_chk_freq; ushort sem_chk_freq;
......
...@@ -1456,8 +1456,8 @@ static service_t* read_services_ini(service_t* service, char* services_ini, DWOR ...@@ -1456,8 +1456,8 @@ static service_t* read_services_ini(service_t* service, char* services_ini, DWOR
{ {
uint i,j; uint i,j;
FILE* fp; FILE* fp;
char cmd[MAX_LINE_LEN+1]; char cmd[INI_MAX_VALUE_LEN];
char host[MAX_LINE_LEN+1]; char host[INI_MAX_VALUE_LEN];
char** sec_list; char** sec_list;
service_t* np; service_t* np;
service_t serv; service_t serv;
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include "sockwrap.h" /* inet_addr */ #include "sockwrap.h" /* inet_addr */
#include "ini_file.h" #include "ini_file.h"
#define INI_MAX_LINE_LEN 256 /* Maximum length of entire line, includes '\0' */
/****************************************************************************/ /****************************************************************************/
/* Truncates white-space chars off end of 'str' */ /* Truncates white-space chars off end of 'str' */
/****************************************************************************/ /****************************************************************************/
...@@ -57,7 +59,7 @@ static BOOL find_section(FILE* fp, const char* section) ...@@ -57,7 +59,7 @@ static BOOL find_section(FILE* fp, const char* section)
{ {
char* p; char* p;
char* tp; char* tp;
char str[MAX_LINE_LEN]; char str[INI_MAX_LINE_LEN];
rewind(fp); rewind(fp);
...@@ -83,7 +85,7 @@ static char* get_value(FILE* fp, const char* section, const char* key, char* val ...@@ -83,7 +85,7 @@ static char* get_value(FILE* fp, const char* section, const char* key, char* val
{ {
char* p; char* p;
char* tp; char* tp;
char str[MAX_LINE_LEN]; char str[INI_MAX_LINE_LEN];
if(fp==NULL) if(fp==NULL)
return(NULL); return(NULL);
...@@ -111,7 +113,7 @@ static char* get_value(FILE* fp, const char* section, const char* key, char* val ...@@ -111,7 +113,7 @@ static char* get_value(FILE* fp, const char* section, const char* key, char* val
p=tp+1; p=tp+1;
while(*p && *p<=' ') p++; while(*p && *p<=' ') p++;
truncsp(p); truncsp(p);
sprintf(value,"%.*s",MAX_VALUE_LEN-1,p); sprintf(value,"%.*s",INI_MAX_VALUE_LEN-1,p);
return(value); return(value);
} }
...@@ -133,11 +135,11 @@ char** iniGetStringList(FILE* fp, const char* section, const char* key ...@@ -133,11 +135,11 @@ char** iniGetStringList(FILE* fp, const char* section, const char* key
,const char* sep, const char* deflt) ,const char* sep, const char* deflt)
{ {
char* value; char* value;
char buf[MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
char** lp; char** lp;
char** np; char** np;
char* token; char* token;
char list[MAX_VALUE_LEN]; char list[INI_MAX_VALUE_LEN];
ulong items=0; ulong items=0;
if((value=get_value(fp,section,key,buf))==NULL || *value==0 /* blank */) if((value=get_value(fp,section,key,buf))==NULL || *value==0 /* blank */)
...@@ -204,7 +206,7 @@ char** iniGetSectionList(FILE* fp, const char* prefix) ...@@ -204,7 +206,7 @@ char** iniGetSectionList(FILE* fp, const char* prefix)
char* tp; char* tp;
char** lp; char** lp;
char** np; char** np;
char str[MAX_LINE_LEN]; char str[INI_MAX_LINE_LEN];
ulong items=0; ulong items=0;
if((lp=malloc(sizeof(char*)))==NULL) if((lp=malloc(sizeof(char*)))==NULL)
...@@ -251,7 +253,7 @@ char** iniGetKeyList(FILE* fp, const char* section) ...@@ -251,7 +253,7 @@ char** iniGetKeyList(FILE* fp, const char* section)
char* tp; char* tp;
char** lp; char** lp;
char** np; char** np;
char str[MAX_LINE_LEN]; char str[INI_MAX_LINE_LEN];
ulong items=0; ulong items=0;
if((lp=malloc(sizeof(char*)))==NULL) if((lp=malloc(sizeof(char*)))==NULL)
...@@ -301,7 +303,7 @@ iniGetNamedStringList(FILE* fp, const char* section) ...@@ -301,7 +303,7 @@ iniGetNamedStringList(FILE* fp, const char* section)
char* name; char* name;
char* value; char* value;
char* tp; char* tp;
char str[MAX_LINE_LEN]; char str[INI_MAX_LINE_LEN];
ulong items=0; ulong items=0;
named_string_t** lp; named_string_t** lp;
named_string_t** np; named_string_t** np;
...@@ -362,7 +364,7 @@ iniGetNamedStringList(FILE* fp, const char* section) ...@@ -362,7 +364,7 @@ iniGetNamedStringList(FILE* fp, const char* section)
long iniGetInteger(FILE* fp, const char* section, const char* key, long deflt) long iniGetInteger(FILE* fp, const char* section, const char* key, long deflt)
{ {
char* value; char* value;
char buf[MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
if((value=get_value(fp,section,key,buf))==NULL) if((value=get_value(fp,section,key,buf))==NULL)
return(deflt); return(deflt);
...@@ -380,7 +382,7 @@ ushort iniGetShortInt(FILE* fp, const char* section, const char* key, ushort def ...@@ -380,7 +382,7 @@ ushort iniGetShortInt(FILE* fp, const char* section, const char* key, ushort def
ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong deflt) ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong deflt)
{ {
char buf[MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
char* value; char* value;
if((value=get_value(fp,section,key,buf))==NULL) if((value=get_value(fp,section,key,buf))==NULL)
...@@ -397,7 +399,7 @@ ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong defl ...@@ -397,7 +399,7 @@ ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong defl
double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt) double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt)
{ {
char buf[MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
char* value; char* value;
if((value=get_value(fp,section,key,buf))==NULL) if((value=get_value(fp,section,key,buf))==NULL)
...@@ -411,7 +413,7 @@ double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt) ...@@ -411,7 +413,7 @@ double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt)
BOOL iniGetBool(FILE* fp, const char* section, const char* key, BOOL deflt) BOOL iniGetBool(FILE* fp, const char* section, const char* key, BOOL deflt)
{ {
char buf[MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
char* value; char* value;
if((value=get_value(fp,section,key,buf))==NULL) if((value=get_value(fp,section,key,buf))==NULL)
...@@ -435,7 +437,7 @@ ulong iniGetBitField(FILE* fp, const char* section, const char* key, ...@@ -435,7 +437,7 @@ ulong iniGetBitField(FILE* fp, const char* section, const char* key,
char* p; char* p;
char* tp; char* tp;
char* value; char* value;
char buf[MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
ulong v=0; ulong v=0;
if((value=get_value(fp,section,key,buf))==NULL) if((value=get_value(fp,section,key,buf))==NULL)
......
...@@ -40,8 +40,7 @@ ...@@ -40,8 +40,7 @@
#include "genwrap.h" #include "genwrap.h"
#define MAX_LINE_LEN 256 /* Maximum length of entire line, includes '\0' */ #define INI_MAX_VALUE_LEN 128 /* Maximum value length, includes '\0' */
#define MAX_VALUE_LEN 128 /* Maximum value length, includes '\0' */
typedef struct { typedef struct {
ulong bit; ulong bit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment