wmbiff: use temporary variables and remove casts.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
Jeremy Sowden 2019-06-28 16:11:15 +01:00 committed by Carlos R. Mafra
parent 0e0dd78437
commit 759e9a363a

View file

@ -16,13 +16,15 @@
/* callbacks specified by the calling function to extract /* callbacks specified by the calling function to extract
substrings to values. */ substrings to values. */
void regulo_atoi(void *dest_int, const char *source) void regulo_atoi(void *dest, const char *source)
{ {
int *dest_int = dest;
/* skip any leading non-digit */ /* skip any leading non-digit */
while (*source != '\0' && !isdigit(*source)) while (*source != '\0' && !isdigit(*source))
source++; source++;
*(int *) dest_int = atoi(source); *dest_int = atoi(source);
} }
void regulo_strcpy(void *dest, const char *source) void regulo_strcpy(void *dest, const char *source)
@ -32,16 +34,18 @@ void regulo_strcpy(void *dest, const char *source)
void regulo_strcpy_tolower(void *dest, const char *source) void regulo_strcpy_tolower(void *dest, const char *source)
{ {
unsigned int i; char *dest_str = dest;
size_t i;
for (i = 0; i < strlen(source); i++) { for (i = 0; i < strlen(source); i++) {
((char *) dest)[i] = tolower(source[i]); dest_str[i] = tolower(source[i]);
} }
((char *) dest)[i] = '\0'; dest_str[i] = '\0';
} }
void regulo_strcpy_skip1(void *dest, const char *source) void regulo_strcpy_skip1(void *dest, const char *source)
{ {
strcpy((char *) dest, source + 1); strcpy(dest, source + 1);
} }
#ifdef USE_GNU_REGEX #ifdef USE_GNU_REGEX