C++: Cannot use variable name of 'new'

This commit is contained in:
Shahram Najm 2022-06-09 18:10:07 +01:00
parent a2034bcaa2
commit 4fe5f475e7
2 changed files with 4 additions and 4 deletions

View File

@ -1466,7 +1466,7 @@ int string_ends_with(const char* str1, const char* str2);
int count_char_in_string(const char* str, char c);
const char* codes_get_product_name(ProductKind product);
const char* grib_get_type_name(int type);
char* string_replace_char(char *str, char old, char new);
char* string_replace_char(char *str, char oldc, char newc);
void string_remove_char(char * str, char c);
/* functions.c */

View File

@ -212,11 +212,11 @@ const char* grib_get_type_name(int type)
/* Replace all occurrences of character in string.
* Returns pointer to the NUL byte at the end of 's'
*/
char *string_replace_char(char *s, char old, char new)
char *string_replace_char(char *s, char oldc, char newc)
{
for (; *s; ++s)
if (*s == old)
*s = new;
if (*s == oldc)
*s = newc;
return s;
}