| 1 | /* $Id$ $Revision$ */ |
| 2 | /* vim:set shiftwidth=4 ts=8: */ |
| 3 | |
| 4 | /************************************************************************* |
| 5 | * Copyright (c) 2011 AT&T Intellectual Property |
| 6 | * All rights reserved. This program and the accompanying materials |
| 7 | * are made available under the terms of the Eclipse Public License v1.0 |
| 8 | * which accompanies this distribution, and is available at |
| 9 | * http://www.eclipse.org/legal/epl-v10.html |
| 10 | * |
| 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
| 12 | *************************************************************************/ |
| 13 | |
| 14 | |
| 15 | #include "vmhdr.h" |
| 16 | /* |
| 17 | * return a copy of s using vmalloc |
| 18 | */ |
| 19 | |
| 20 | char *vmstrdup(Vmalloc_t * v, register const char *s) |
| 21 | { |
| 22 | register char *t; |
| 23 | register int n; |
| 24 | |
| 25 | return ((t = |
| 26 | vmalloc(v, n = |
| 27 | strlen(s) + 1)) ? (char *) memcpy(t, s, |
| 28 | n) : (char *) 0); |
| 29 | } |
| 30 | |