Fixed bacnet_strdup() to compile with C89/C90 without warnings.
This commit is contained in:
+10
-7
@@ -2196,13 +2196,16 @@ int bacnet_snprintf(
|
|||||||
*/
|
*/
|
||||||
char *bacnet_strdup(const char *s)
|
char *bacnet_strdup(const char *s)
|
||||||
{
|
{
|
||||||
if (s == NULL) {
|
size_t size;
|
||||||
return NULL;
|
char *p = NULL;
|
||||||
}
|
|
||||||
size_t size = strlen(s) + 1;
|
if (s) {
|
||||||
char *p = malloc(size);
|
size = strlen(s) + 1;
|
||||||
if (p != NULL) {
|
p = malloc(size);
|
||||||
memcpy(p, s, size);
|
if (p != NULL) {
|
||||||
|
memcpy(p, s, size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user