7712 mandoc -Tlint does always exit with error code 0
[unleashed.git] / usr / src / cmd / lvm / rpc.metamedd / med_mem.c
blobb52cc4c375ae5b4384c12136f05e8713af227af4
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 #pragma ident "%Z%%M% %I% %E% SMI"
26 * Copyright (c) 1994, 2000 by Sun Microsystems, Inc.
27 * All rights reserved.
30 #include "med_local.h"
33 * free
35 void
36 Free(
37 void *p
40 free(p);
44 * malloc
46 void *
47 Malloc(
48 size_t s
51 void *mem;
53 if ((mem = malloc(s)) == NULL) {
54 med_perror("");
55 med_exit(1);
57 return (mem);
61 * zalloc
63 void *
64 Zalloc(
65 size_t s
68 return (memset(Malloc(s), 0, s));
72 * realloc
74 void *
75 Realloc(
76 void *p,
77 size_t s
80 if ((p = realloc(p, s)) == NULL) {
81 med_perror("");
82 med_exit(1);
84 return (p);
88 * calloc
90 void *
91 Calloc(
92 size_t n,
93 size_t s
96 unsigned long total;
98 if (n == 0 || s == 0) {
99 total = 0;
100 } else {
101 total = (unsigned long)n * s;
102 /* check for overflow */
103 if (total / n != s)
104 return (NULL);
106 return (Zalloc(total));
110 * strdup
112 char *
113 Strdup(
114 char *p
117 if ((p = strdup(p)) == NULL) {
118 med_perror("");
119 med_exit(1);
121 return (p);