mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
- end may be used uninitialized.
- TODO: should eventually use skip_whitespace there
This commit is contained in:
parent
b3a071543d
commit
e766715032
@ -51,7 +51,7 @@ static struct sort_key
|
|||||||
|
|
||||||
static char *get_key(char *str, struct sort_key *key, int flags)
|
static char *get_key(char *str, struct sort_key *key, int flags)
|
||||||
{
|
{
|
||||||
int start=0,end,len,i,j;
|
int start = 0, end = 0, len, i, j;
|
||||||
|
|
||||||
/* Special case whole string, so we don't have to make a copy */
|
/* Special case whole string, so we don't have to make a copy */
|
||||||
if(key->range[0]==1 && !key->range[1] && !key->range[2] && !key->range[3]
|
if(key->range[0]==1 && !key->range[1] && !key->range[2] && !key->range[3]
|
||||||
@ -83,6 +83,7 @@ static char *get_key(char *str, struct sort_key *key, int flags)
|
|||||||
/* Key with explicit separator starts after separator */
|
/* Key with explicit separator starts after separator */
|
||||||
if(key_separator && str[start]==key_separator) start++;
|
if(key_separator && str[start]==key_separator) start++;
|
||||||
/* Strip leading whitespace if necessary */
|
/* Strip leading whitespace if necessary */
|
||||||
|
//XXX: skip_whitespace()
|
||||||
if(flags&FLAG_b) while(isspace(str[start])) start++;
|
if(flags&FLAG_b) while(isspace(str[start])) start++;
|
||||||
/* Strip trailing whitespace if necessary */
|
/* Strip trailing whitespace if necessary */
|
||||||
if(flags&FLAG_bb) while(end>start && isspace(str[end-1])) end--;
|
if(flags&FLAG_bb) while(end>start && isspace(str[end-1])) end--;
|
||||||
|
Loading…
Reference in New Issue
Block a user