Freie strdupa Implementierung

TOP5: Diverses, Verschiedenes, ...

  • Homepage
  • Über mich
  • Fotos
  • Musik
  • Kontakt

Jan 27: Freie strdupa Implementierung

Ohne Gewährleistung auf Funktionalität oder irgendwas, aber nachdem mir heute jemand gesagt hat, dass er einfach strdupa mit strdup #defined, dachte ich mir, suche ich lieber mal fix nach einer leak-freien Lösung.

#define strdupa(x) (char*)strcpy((char*)alloca(strlen((const char*)x)+1),(const char*)x)

Es benötigt natürlich die entsprechenden Header, lt. Dragonfly BSD sind das stdlib.h und string.h

Lizenz: ISC/MIT/X11/libpng, Copyright (C) 2009 Patrick Georgi <patrick.georgi@coresystems.de> 

Posted by Patrick Georgi in Software Comments: (0) Trackbacks: (0)

Trackbacks
Trackback specific URI for this entry

No Trackbacks

Comments
Display comments as (Linear | Threaded)

No comments


Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
Standard emoticons like :-) and ;-) are converted to images.
 
 

Statische Seiten

 

Layout by Andreas Viklund | Serendipity template by Carl