Sha256: f24774c6b263b552811d949b02e56348141743b453272cb9099cfc025e278d40

Contents?: true

Size: 368 Bytes

Versions: 9

Compression:

Stored size: 368 Bytes

Contents

//
// string_dup.c
//
// Copyright (c) 2014 Stephen Mathieson
// MIT licensed
//

#ifndef HAVE_STRINGDUP

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

char *
string_dup(const char *str) {
  if (!str) return NULL;
  int len = strlen(str) + 1;
  char *buf = malloc(len);
  if (buf) memcpy(buf, str, len);
  return buf;
}

#endif /* HAVE_STRINGDUP */

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mathematical-1.6.20 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.18 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.14 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.13 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.12 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.11 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.10 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.9 ext/mathematical/mtex2MML/src/string_dup.c
mathematical-1.6.8 ext/mathematical/mtex2MML/src/string_dup.c