Simplify str_toupper() in "utils.c".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2011-03-04 08:51:36 +01:00
parent 05900b62e9
commit 061f74108b
3 changed files with 25 additions and 29 deletions

View File

@ -873,7 +873,7 @@ char *new_tempfile (const char *, int);
void erase_note (char **, enum eraseflg);
int parse_date (char *, enum datefmt, int *, int *, int *,
struct date *);
char *str_toupper (char *);
void str_toupper (char *);
void file_close (FILE *, const char *);
void psleep (unsigned);

View File

@ -1916,13 +1916,13 @@ ical_chk_header (FILE *fd, unsigned *lineno)
(void)fgets (buf, BUFSIZ, fd);
(*lineno)++;
if (buf == NULL
|| strncmp (str_toupper (buf), icalheader.str, icalheader.len) != 0)
{
if (buf == NULL) return HEADER_MALFORMED;
str_toupper (buf);
if (strncmp (buf, icalheader.str, icalheader.len) != 0)
return HEADER_MALFORMED;
}
else
{
const int AWAITED = 1;
float version = HEADER_MALFORMED;
int read;
@ -1941,7 +1941,6 @@ ical_chk_header (FILE *fd, unsigned *lineno)
}
while (read != AWAITED);
return version;
}
}
/*

View File

@ -957,14 +957,11 @@ parse_date (char *date_string, enum datefmt datefmt, int *year, int *month,
return 1;
}
char *
void
str_toupper (char *s)
{
int len;
for (len = 0; s && s[len]; len++)
s[len] = toupper (s[len]);
return s;
if (!s) return;
for (; *s; s++) *s = toupper (*s);
}
void