strdup name confusing

This commit is contained in:
iceman1001 2020-01-05 22:24:24 +01:00
commit 719fcf91ab
3 changed files with 8 additions and 8 deletions

View file

@ -169,7 +169,7 @@ check_script:
// remove linebreaks // remove linebreaks
strcleanrn(script_cmd_buf, sizeof(script_cmd_buf)); strcleanrn(script_cmd_buf, sizeof(script_cmd_buf));
cmd = strdup(script_cmd_buf); cmd = str_dup(script_cmd_buf);
if (cmd != NULL) if (cmd != NULL)
printprompt = true; printprompt = true;
} }
@ -177,7 +177,7 @@ check_script:
// If there is a script command // If there is a script command
if (execCommand) { if (execCommand) {
cmd = strdup(script_cmd); cmd = str_dup(script_cmd);
if (cmd != NULL) if (cmd != NULL)
printprompt = true; printprompt = true;
@ -206,7 +206,7 @@ check_script:
// remove linebreaks // remove linebreaks
strcleanrn(script_cmd_buf, sizeof(script_cmd_buf)); strcleanrn(script_cmd_buf, sizeof(script_cmd_buf));
cmd = strdup(script_cmd_buf); cmd = str_dup(script_cmd_buf);
if (cmd != NULL) if (cmd != NULL)
printprompt = true; printprompt = true;

View file

@ -919,10 +919,10 @@ void strcreplace(char *buf, size_t len, char from, char to) {
} }
char *strdup(const char *src) { char *str_dup(const char *src) {
return strndup(src, strlen(src)); return str_ndup(src, strlen(src));
} }
char *strndup(const char *src, size_t len) { char *str_ndup(const char *src, size_t len) {
char *dest = (char *) calloc(len + 1, sizeof(uint8_t)); char *dest = (char *) calloc(len + 1, sizeof(uint8_t));
if (dest != NULL) { if (dest != NULL) {

View file

@ -99,7 +99,7 @@ bool str_endswith(const char *s, const char *suffix); // check for suffix in
void clean_ascii(unsigned char *buf, size_t len); void clean_ascii(unsigned char *buf, size_t len);
void strcleanrn(char *buf, size_t len); void strcleanrn(char *buf, size_t len);
void strcreplace(char *buf, size_t len, char from, char to); void strcreplace(char *buf, size_t len, char from, char to);
char *strdup(const char *src); char *str_dup(const char *src);
char *strndup(const char *src, size_t len); char *str_ndup(const char *src, size_t len);
int hexstring_to_u96(uint32_t *hi2, uint32_t *hi, uint32_t *lo, const char *str); int hexstring_to_u96(uint32_t *hi2, uint32_t *hi, uint32_t *lo, const char *str);
#endif #endif