~kevin8t8/mutt

ref: 2fbc29ec127aa3d699def01e574f14996db8cacc mutt/strdup.c -rw-r--r-- 307 bytes
2fbc29ecKevin McCarthy Allow my_var assignments to reference the $my_var in the value. 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* ultrix doesn't have strdup */

#include <string.h>
#include <stdlib.h>

char *strdup (const char *s)	/* __MEM_CHECKED__ */
{
  char *d;

  if (s == NULL)
    return NULL;

  if ((d = malloc (strlen (s) + 1)) == NULL)	/* __MEM_CHECKED__ */
    return NULL;

  memcpy (d, s, strlen (s) + 1);
  return d;
}