Replace macro with inline function (#7365)

This commit is contained in:
Kamil Tekiela 2021-08-13 20:03:26 +01:00 committed by GitHub
parent 6db4b972d0
commit d902b3a844
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 31 deletions

View file

@ -71,4 +71,16 @@ static inline MYSQLND_CSTRING mnd_str2c(const MYSQLND_STRING str)
return ret;
}
static inline void mysqlnd_set_string(MYSQLND_STRING *buf, const char *string, size_t len) {
if (buf->s) {
mnd_efree(buf->s);
buf->s = NULL;
buf->l = 0;
}
if (string) {
buf->s = mnd_pestrndup(string, len, 0);
buf->l = len;
}
}
#endif /* MYSQLND_ALLOC_H */