mirror of
https://github.com/curl/curl.git
synced 2026-07-31 20:28:04 +03:00
strparse: switch the API to work on 'const char *'
The functions are not meant to touch the input anyway. Closes #16316
This commit is contained in:
parent
c1341813bd
commit
92611f2a56
8 changed files with 43 additions and 41 deletions
|
|
@ -26,10 +26,10 @@
|
|||
|
||||
/* Get a word until the first DELIM or end of string. At least one byte long.
|
||||
return non-zero on error */
|
||||
int Curl_str_until(char **linep, struct Curl_str *out,
|
||||
int Curl_str_until(const char **linep, struct Curl_str *out,
|
||||
const size_t max, char delim)
|
||||
{
|
||||
char *s = *linep;
|
||||
const char *s = *linep;
|
||||
size_t len = 0;
|
||||
DEBUGASSERT(linep && *linep && out && max && delim);
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ int Curl_str_until(char **linep, struct Curl_str *out,
|
|||
|
||||
/* Get a word until the first space or end of string. At least one byte long.
|
||||
return non-zero on error */
|
||||
int Curl_str_word(char **linep, struct Curl_str *out,
|
||||
int Curl_str_word(const char **linep, struct Curl_str *out,
|
||||
const size_t max)
|
||||
{
|
||||
return Curl_str_until(linep, out, max, ' ');
|
||||
|
|
@ -60,10 +60,10 @@ int Curl_str_word(char **linep, struct Curl_str *out,
|
|||
|
||||
/* Get a "quoted" word. No escaping possible.
|
||||
return non-zero on error */
|
||||
int Curl_str_quotedword(char **linep, struct Curl_str *out,
|
||||
int Curl_str_quotedword(const char **linep, struct Curl_str *out,
|
||||
const size_t max)
|
||||
{
|
||||
char *s = *linep;
|
||||
const char *s = *linep;
|
||||
size_t len = 0;
|
||||
DEBUGASSERT(linep && *linep && out && max);
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ int Curl_str_quotedword(char **linep, struct Curl_str *out,
|
|||
|
||||
/* Advance over a single character.
|
||||
return non-zero on error */
|
||||
int Curl_str_single(char **linep, char byte)
|
||||
int Curl_str_single(const char **linep, char byte)
|
||||
{
|
||||
DEBUGASSERT(linep && *linep);
|
||||
if(**linep != byte)
|
||||
|
|
@ -98,14 +98,14 @@ int Curl_str_single(char **linep, char byte)
|
|||
|
||||
/* Advance over a single space.
|
||||
return non-zero on error */
|
||||
int Curl_str_singlespace(char **linep)
|
||||
int Curl_str_singlespace(const char **linep)
|
||||
{
|
||||
return Curl_str_single(linep, ' ');
|
||||
}
|
||||
|
||||
/* Get an unsigned number. Leading zeroes are accepted.
|
||||
return non-zero on error */
|
||||
int Curl_str_number(char **linep, size_t *nump, size_t max)
|
||||
int Curl_str_number(const char **linep, size_t *nump, size_t max)
|
||||
{
|
||||
size_t num = 0;
|
||||
DEBUGASSERT(linep && *linep && nump);
|
||||
|
|
@ -125,7 +125,7 @@ int Curl_str_number(char **linep, size_t *nump, size_t max)
|
|||
|
||||
/* CR or LF
|
||||
return non-zero on error */
|
||||
int Curl_str_newline(char **linep)
|
||||
int Curl_str_newline(const char **linep)
|
||||
{
|
||||
DEBUGASSERT(linep && *linep);
|
||||
if(ISNEWLINE(**linep)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue