Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
33480b45
Commit
33480b45
authored
Jul 16, 2009
by
Joey Adams
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rusty's cleanup to ciniparser.c's strstrip and strlwc
parent
0be3e9db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
25 deletions
+14
-25
ccan/ciniparser/ciniparser.c
ccan/ciniparser/ciniparser.c
+14
-25
No files found.
ccan/ciniparser/ciniparser.c
View file @
33480b45
...
@@ -69,16 +69,9 @@ static char *strlwc(const char *s)
...
@@ -69,16 +69,9 @@ static char *strlwc(const char *s)
if
(
s
==
NULL
)
if
(
s
==
NULL
)
return
NULL
;
return
NULL
;
memset
(
l
,
0
,
ASCIILINESZ
+
1
);
for
(
i
=
0
;
s
[
i
]
&&
i
<
ASCIILINESZ
;
i
++
)
i
=
0
;
l
[
i
]
=
tolower
(
s
[
i
]);
l
[
i
]
=
'\0'
;
while
(
s
[
i
]
&&
i
<
ASCIILINESZ
)
{
l
[
i
]
=
(
char
)
tolower
((
int
)
s
[
i
]);
i
++
;
}
l
[
ASCIILINESZ
]
=
(
char
)
0
;
return
l
;
return
l
;
}
}
...
@@ -94,30 +87,26 @@ static char *strlwc(const char *s)
...
@@ -94,30 +87,26 @@ static char *strlwc(const char *s)
* is statically allocated, it will be modified at each function call
* is statically allocated, it will be modified at each function call
* (not re-entrant).
* (not re-entrant).
*/
*/
static
char
*
strstrip
(
char
*
s
)
static
char
*
strstrip
(
c
onst
c
har
*
s
)
{
{
static
char
l
[
ASCIILINESZ
+
1
];
static
char
l
[
ASCIILINESZ
+
1
];
char
*
last
;
unsigned
int
i
,
numspc
;
if
(
s
==
NULL
)
if
(
s
==
NULL
)
return
NULL
;
return
NULL
;
while
(
isspace
(
(
int
)
*
s
)
&&
*
s
)
while
(
isspace
(
*
s
)
)
s
++
;
s
++
;
memset
(
l
,
0
,
ASCIILINESZ
+
1
);
for
(
i
=
numspc
=
0
;
s
[
i
]
&&
i
<
ASCIILINESZ
;
i
++
)
{
strcpy
(
l
,
s
);
l
[
i
]
=
s
[
i
];
last
=
l
+
strlen
(
l
);
if
(
isspace
(
l
[
i
]))
numspc
++
;
while
(
last
>
l
)
{
else
if
(
!
isspace
((
int
)
*
(
last
-
1
)))
numspc
=
0
;
break
;
last
--
;
}
}
l
[
i
-
numspc
]
=
'\0'
;
*
last
=
(
char
)
0
;
return
l
;
return
(
char
*
)
l
;
}
}
/**
/**
...
...
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