vasprintf.c (e74101e4eff767325553039def89de70b70f36d3) | vasprintf.c (6879bea818b8bbf6d3b89560fb6b151a52eed368) |
---|---|
1/* $OpenBSD: vasprintf.c,v 1.4 1998/06/21 22:13:47 millert Exp $ */ 2 3/* 4 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 39 unchanged lines hidden (view full) --- 48 f._file = -1; 49 f._flags = __SWR | __SSTR | __SALC; 50 f._bf._base = f._p = (unsigned char *)malloc(128); 51 if (f._bf._base == NULL) { 52 *str = NULL; 53 errno = ENOMEM; 54 return (-1); 55 } | 1/* $OpenBSD: vasprintf.c,v 1.4 1998/06/21 22:13:47 millert Exp $ */ 2 3/* 4 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 39 unchanged lines hidden (view full) --- 48 f._file = -1; 49 f._flags = __SWR | __SSTR | __SALC; 50 f._bf._base = f._p = (unsigned char *)malloc(128); 51 if (f._bf._base == NULL) { 52 *str = NULL; 53 errno = ENOMEM; 54 return (-1); 55 } |
56 f._bf._size = f._w = 127; /* Leave room for the NULL */ | 56 f._bf._size = f._w = 127; /* Leave room for the NUL */ |
57 f._extra = &ext; 58 INITEXTRA(&f); 59 ret = __vfprintf(&f, fmt, ap); 60 *f._p = '\0'; 61 f._bf._base = reallocf(f._bf._base, f._bf._size + 1); 62 if (f._bf._base == NULL) { 63 errno = ENOMEM; 64 ret = -1; 65 } 66 *str = (char *)f._bf._base; 67 return (ret); 68} | 57 f._extra = &ext; 58 INITEXTRA(&f); 59 ret = __vfprintf(&f, fmt, ap); 60 *f._p = '\0'; 61 f._bf._base = reallocf(f._bf._base, f._bf._size + 1); 62 if (f._bf._base == NULL) { 63 errno = ENOMEM; 64 ret = -1; 65 } 66 *str = (char *)f._bf._base; 67 return (ret); 68} |