Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
vmstrdup.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include <stddef.h>
12#include <string.h>
13#include <vmalloc/vmalloc.h>
14
15/*
16 * return a copy of s using vmalloc
17 */
18
19char *vmstrdup(Vmalloc_t * v, const char *s)
20{
21
22 size_t len = strlen(s) + 1;
23 char *t = vmalloc(v, len);
24 if (t == NULL) {
25 return NULL;
26 }
27
28 memcpy(t, s, len);
29
30 return t;
31}
static double len(glCompPoint p)
Definition glutils.c:150
node NULL
Definition grammar.y:163
Definition grammar.c:93
void * vmalloc(Vmalloc_t *vm, size_t size)
Definition vmalloc.c:40
char * vmstrdup(Vmalloc_t *v, const char *s)
Definition vmstrdup.c:19