A small library that's provide helpers for programmers

Dependents:   PYRN

Committer:
clemounet
Date:
Tue Apr 14 13:07:53 2015 +0000
Revision:
4:eef83534b19e
Parent:
1:ee7a5f05513d
.add CallBack

Who changed what in which revision?

UserRevisionLine numberNew contents of line
clemounet 1:ee7a5f05513d 1
clemounet 1:ee7a5f05513d 2 #include "MyLibc.h"
clemounet 1:ee7a5f05513d 3
clemounet 1:ee7a5f05513d 4 #include "mbed.h"
clemounet 1:ee7a5f05513d 5
clemounet 1:ee7a5f05513d 6 char *strdup(const char *str) {
clemounet 1:ee7a5f05513d 7 uint32_t len;
clemounet 1:ee7a5f05513d 8 char *copy;
clemounet 1:ee7a5f05513d 9
clemounet 1:ee7a5f05513d 10 len = strlen(str) + 1;
clemounet 1:ee7a5f05513d 11 if (!(copy = (char*)malloc(len)))
clemounet 1:ee7a5f05513d 12 return 0;
clemounet 1:ee7a5f05513d 13 strncpy(copy,str,len);
clemounet 1:ee7a5f05513d 14 return copy;
clemounet 1:ee7a5f05513d 15 }