stand.h (100392) | stand.h (100394) |
---|---|
1/* 2 * Copyright (c) 1998 Michael Smith. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/* 2 * Copyright (c) 1998 Michael Smith. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libstand/stand.h 100392 2002-07-20 03:55:06Z peter $ | 26 * $FreeBSD: head/lib/libstand/stand.h 100394 2002-07-20 04:18:20Z peter $ |
27 * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ 28 */ 29 30/*- 31 * Copyright (c) 1993 32 * The Regents of the University of California. All rights reserved. 33 * 34 * Redistribution and use in source and binary forms, with or without --- 351 unchanged lines hidden (view full) --- 386#ifndef _BYTEORDER_FUNC_DEFINED 387#define _BYTEORDER_FUNC_DEFINED 388#define htonl(x) __htonl(x) 389#define htons(x) __htons(x) 390#define ntohl(x) __ntohl(x) 391#define ntohs(x) __ntohs(x) 392#endif 393 | 27 * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ 28 */ 29 30/*- 31 * Copyright (c) 1993 32 * The Regents of the University of California. All rights reserved. 33 * 34 * Redistribution and use in source and binary forms, with or without --- 351 unchanged lines hidden (view full) --- 386#ifndef _BYTEORDER_FUNC_DEFINED 387#define _BYTEORDER_FUNC_DEFINED 388#define htonl(x) __htonl(x) 389#define htons(x) __htons(x) 390#define ntohl(x) __ntohl(x) 391#define ntohs(x) __ntohs(x) 392#endif 393 |
394#if 0 | 394void *Malloc(size_t, const char *, int); 395void *Calloc(size_t, size_t, const char *, int); 396void *Realloc(void *, size_t, const char *, int); 397void Free(void *, const char *, int); |
395 | 398 |
396static inline void * 397malloc_debug(size_t size, const char *file, int line) 398{ 399 void *p; 400 printf("%s:%d malloc(%ld)", file, line, size); 401 p = malloc(size); 402 printf("=%p\n", p); 403 return p; 404} 405 406static inline void 407free_debug(void *p, const char *file, int line) 408{ 409 printf("%s:%d free(%p)\n", file, line, p); 410 free(p); 411} 412 413#define malloc(x) malloc_debug(x, __FILE__, __LINE__) 414#define free(x) free_debug(x, __FILE__, __LINE__) 415 | 399#if 1 400#define malloc(x) Malloc(x, __FILE__, __LINE__) 401#define calloc(x, y) Calloc(x, y, __FILE__, __LINE__) 402#define free(x) Free(x, __FILE__, __LINE__) 403#define realloc(x, y) Realloc(x, y, __FILE__, __LINE__) 404#else 405#define malloc(x) Malloc(x, NULL 0) 406#define calloc(x, y) Calloc(x, y, NULL, 0) 407#define free(x) Free(x, NULL, 0) 408#define realloc(x, y) Realloc(x, y, NULL, 0) |
416#endif | 409#endif |