Deleted Added
full compact
mbuf.c (22997) mbuf.c (25630)
1/*
2 * PPP Memory handling module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP Memory handling module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $Id$
20 * $Id: mbuf.c,v 1.5 1997/02/22 16:10:34 peter Exp $
21 *
22 */
23#include "defs.h"
24
25struct memmap {
26 struct mbuf *queue;
27 int count;
28} MemMap[MB_MAX+2];

--- 17 unchanged lines hidden (view full) ---

46int type;
47{
48 u_char *p;
49 struct mbuf *bp;
50
51 if (type > MB_MAX)
52 logprintf("bad type %d\n", type);
53 bp = (struct mbuf *)malloc(sizeof(struct mbuf));
21 *
22 */
23#include "defs.h"
24
25struct memmap {
26 struct mbuf *queue;
27 int count;
28} MemMap[MB_MAX+2];

--- 17 unchanged lines hidden (view full) ---

46int type;
47{
48 u_char *p;
49 struct mbuf *bp;
50
51 if (type > MB_MAX)
52 logprintf("bad type %d\n", type);
53 bp = (struct mbuf *)malloc(sizeof(struct mbuf));
54 if (bp == NULL) {
55 logprintf("failed to allocate memory: %u\n", sizeof(struct mbuf));
56 fprintf(stderr,"failed to allocate memory: %u\n", sizeof(struct mbuf));
57 exit(0);
58 }
54 bzero(bp, sizeof(struct mbuf));
55 p = (u_char *)malloc(cnt);
59 bzero(bp, sizeof(struct mbuf));
60 p = (u_char *)malloc(cnt);
61 if (p == NULL) {
62 logprintf("failed to allocate memory: %d\n", cnt);
63 fprintf(stderr,"failed to allocate memory: %d\n", cnt);
64 exit(0);
65 }
56 MemMap[type].count += cnt;
57 totalalloced += cnt;
58 bp->base = p;
59 bp->size = bp->cnt = cnt;
60 bp->type = type;
61 return(bp);
62}
63

--- 123 unchanged lines hidden ---
66 MemMap[type].count += cnt;
67 totalalloced += cnt;
68 bp->base = p;
69 bp->size = bp->cnt = cnt;
70 bp->type = type;
71 return(bp);
72}
73

--- 123 unchanged lines hidden ---