Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
c9604e21
Commit
c9604e21
authored
Jul 27, 2008
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the module array to use an item_list structure.
parent
b583594a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
23 deletions
+13
-23
loadparm.c
loadparm.c
+13
-23
No files found.
loadparm.c
View file @
c9604e21
...
@@ -87,9 +87,8 @@ struct parm_struct {
...
@@ -87,9 +87,8 @@ struct parm_struct {
#endif
#endif
/* some helpful bits */
/* some helpful bits */
#define pSECTION(i) SectionPtrs[i]
#define iSECTION(i) ((section*)section_list.items)[i]
#define iSECTION(i) (*pSECTION(i))
#define LP_SNUM_OK(i) ((i) >= 0 && (i) < (int)section_list.count)
#define LP_SNUM_OK(i) ((i) >= 0 && (i) < iNumSections)
/*
/*
* This structure describes global (ie., server-wide) parameters.
* This structure describes global (ie., server-wide) parameters.
...
@@ -205,8 +204,7 @@ static section sDefault = {
...
@@ -205,8 +204,7 @@ static section sDefault = {
};
};
/* local variables */
/* local variables */
static
section
**
SectionPtrs
=
NULL
;
static
item_list
section_list
=
EMPTY_ITEM_LIST
;
static
int
iNumSections
=
0
;
static
int
iSectionIndex
=
-
1
;
static
int
iSectionIndex
=
-
1
;
static
BOOL
bInGlobalSection
=
True
;
static
BOOL
bInGlobalSection
=
True
;
...
@@ -516,10 +514,10 @@ static int getsectionbyname(char *name, section *psectionDest)
...
@@ -516,10 +514,10 @@ static int getsectionbyname(char *name, section *psectionDest)
{
{
int
i
;
int
i
;
for
(
i
=
iNumSections
-
1
;
i
>=
0
;
i
--
)
{
for
(
i
=
section_list
.
count
-
1
;
i
>=
0
;
i
--
)
{
if
(
strwicmp
(
iSECTION
(
i
).
name
,
name
)
==
0
)
{
if
(
strwicmp
(
iSECTION
(
i
).
name
,
name
)
==
0
)
{
if
(
psectionDest
!=
NULL
)
if
(
psectionDest
!=
NULL
)
copy_section
(
psectionDest
,
p
SECTION
(
i
));
copy_section
(
psectionDest
,
&
i
SECTION
(
i
));
break
;
break
;
}
}
}
}
...
@@ -531,7 +529,7 @@ static int getsectionbyname(char *name, section *psectionDest)
...
@@ -531,7 +529,7 @@ static int getsectionbyname(char *name, section *psectionDest)
static
int
add_a_section
(
char
*
name
)
static
int
add_a_section
(
char
*
name
)
{
{
int
i
;
int
i
;
int
num_to_alloc
=
iNumSections
+
1
;
section
*
s
;
/* it might already exist */
/* it might already exist */
if
(
name
)
{
if
(
name
)
{
...
@@ -540,20 +538,12 @@ static int add_a_section(char *name)
...
@@ -540,20 +538,12 @@ static int add_a_section(char *name)
return
i
;
return
i
;
}
}
i
=
iNumSections
;
i
=
section_list
.
count
;
SectionPtrs
=
realloc_array
(
SectionPtrs
,
section
*
,
num_to_alloc
);
s
=
EXPAND_ITEM_LIST
(
&
section_list
,
section
,
2
);
if
(
SectionPtrs
)
init_section
(
s
);
pSECTION
(
iNumSections
)
=
new
(
section
);
if
(
!
SectionPtrs
||
!
pSECTION
(
iNumSections
))
return
-
1
;
iNumSections
++
;
init_section
(
pSECTION
(
i
));
if
(
name
)
if
(
name
)
string_set
(
&
iSECTION
(
i
).
name
,
name
);
string_set
(
&
s
->
name
,
name
);
return
i
;
return
i
;
}
}
...
@@ -620,7 +610,7 @@ static BOOL do_parameter(char *parmname, char *parmvalue)
...
@@ -620,7 +610,7 @@ static BOOL do_parameter(char *parmname, char *parmvalue)
rprintf
(
FLOG
,
"Global parameter %s found in module section!
\n
"
,
parmname
);
rprintf
(
FLOG
,
"Global parameter %s found in module section!
\n
"
,
parmname
);
return
True
;
return
True
;
}
}
parm_ptr
=
((
char
*
)
p
SECTION
(
iSectionIndex
))
+
PTR_DIFF
(
def_ptr
,
&
sDefault
);
parm_ptr
=
((
char
*
)
&
i
SECTION
(
iSectionIndex
))
+
PTR_DIFF
(
def_ptr
,
&
sDefault
);
}
}
/* now switch on the type of variable it is */
/* now switch on the type of variable it is */
...
@@ -742,7 +732,7 @@ BOOL lp_load(char *pszFname, int globals_only)
...
@@ -742,7 +732,7 @@ BOOL lp_load(char *pszFname, int globals_only)
/* Return the max number of modules (sections). */
/* Return the max number of modules (sections). */
int
lp_num_modules
(
void
)
int
lp_num_modules
(
void
)
{
{
return
iNumSections
;
return
section_list
.
count
;
}
}
/* Return the number of the module with the given name, or -1 if it doesn't
/* Return the number of the module with the given name, or -1 if it doesn't
...
@@ -753,7 +743,7 @@ int lp_number(char *name)
...
@@ -753,7 +743,7 @@ int lp_number(char *name)
{
{
int
i
;
int
i
;
for
(
i
=
iNumSections
-
1
;
i
>=
0
;
i
--
)
{
for
(
i
=
section_list
.
count
-
1
;
i
>=
0
;
i
--
)
{
if
(
strcmp
(
lp_name
(
i
),
name
)
==
0
)
if
(
strcmp
(
lp_name
(
i
),
name
)
==
0
)
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment