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

#define ROOT_SECTION NULL

parent f5d35a1e
Branches
Tags
No related merge requests found
...@@ -445,7 +445,7 @@ static jsval get_value(JSContext *cx, char* value) ...@@ -445,7 +445,7 @@ static jsval get_value(JSContext *cx, char* value)
static JSBool static JSBool
js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
char* section=NULL; char* section=ROOT_SECTION;
char* key; char* key;
char** list; char** list;
char buf[INI_MAX_VALUE_LEN]; char buf[INI_MAX_VALUE_LEN];
...@@ -511,7 +511,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva ...@@ -511,7 +511,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
static JSBool static JSBool
js_iniSetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) js_iniSetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
char* section=NULL; char* section=ROOT_SECTION;
char* key; char* key;
char* result=NULL; char* result=NULL;
int32 i; int32 i;
...@@ -607,7 +607,7 @@ js_iniGetSections(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval * ...@@ -607,7 +607,7 @@ js_iniGetSections(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
static JSBool static JSBool
js_iniGetKeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) js_iniGetKeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
char* section=NULL; char* section=ROOT_SECTION;
char** list; char** list;
jsint i; jsint i;
jsval val; jsval val;
...@@ -641,7 +641,7 @@ js_iniGetKeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval ...@@ -641,7 +641,7 @@ js_iniGetKeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
static JSBool static JSBool
js_iniGetObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) js_iniGetObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{ {
char* section=NULL; char* section=ROOT_SECTION;
jsint i; jsint i;
JSObject* object; JSObject* object;
private_t* p; private_t* p;
......
...@@ -86,7 +86,7 @@ static BOOL find_section(FILE* fp, const char* section) ...@@ -86,7 +86,7 @@ static BOOL find_section(FILE* fp, const char* section)
rewind(fp); rewind(fp);
if(section==NULL) if(section==ROOT_SECTION)
return(TRUE); return(TRUE);
while(!feof(fp)) { while(!feof(fp)) {
...@@ -106,7 +106,7 @@ static size_t find_section_index(str_list_t list, const char* section) ...@@ -106,7 +106,7 @@ static size_t find_section_index(str_list_t list, const char* section)
char str[INI_MAX_VALUE_LEN]; char str[INI_MAX_VALUE_LEN];
size_t i; size_t i;
if(section==NULL) if(section==ROOT_SECTION)
return(0); return(0);
for(i=0; list[i]!=NULL; i++) { for(i=0; list[i]!=NULL; i++) {
...@@ -198,7 +198,7 @@ size_t iniAddSection(str_list_t* list, const char* section ...@@ -198,7 +198,7 @@ size_t iniAddSection(str_list_t* list, const char* section
char str[INI_MAX_LINE_LEN]; char str[INI_MAX_LINE_LEN];
size_t i; size_t i;
if(section==NULL) if(section==ROOT_SECTION)
return(0); return(0);
i=find_section_index(*list, section); i=find_section_index(*list, section);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "str_list.h" /* strList_t */ #include "str_list.h" /* strList_t */
#define INI_MAX_VALUE_LEN 1024 /* Maximum value length, includes '\0' */ #define INI_MAX_VALUE_LEN 1024 /* Maximum value length, includes '\0' */
#define ROOT_SECTION NULL
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