1*1bb92983SJerome Forissier // SPDX-License-Identifier: BSD-2-Clause 2b0104773SPascal Brand /* 3b0104773SPascal Brand * Copyright (c) 2014, STMicroelectronics International N.V. 4b0104773SPascal Brand */ 5b0104773SPascal Brand #include <stdlib.h> 6b0104773SPascal Brand #include <string.h> 7b0104773SPascal Brand strdup(const char * s)8b0104773SPascal Brandchar *strdup(const char *s) 9b0104773SPascal Brand { 10b0104773SPascal Brand size_t l = strlen(s) + 1; 11b0104773SPascal Brand char *p = malloc(l); 12b0104773SPascal Brand 13b0104773SPascal Brand if (p) 14b0104773SPascal Brand memcpy(p, s, l); 15b0104773SPascal Brand return p; 16b0104773SPascal Brand } 17