~ubuntu-branches/ubuntu/quantal/nettle/quantal

« back to all changes in this revision

Viewing changes to realloc.c

  • Committer: Bazaar Package Importer
  • Author(s): Marek Habersack
  • Date: 2004-05-04 15:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20040504155602-7jbhw5mabvwksl3j
Tags: upstream-1.10
Import upstream version 1.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* realloc.c
 
2
 *
 
3
 */
 
4
 
 
5
/* nettle, low-level cryptographics library
 
6
 *
 
7
 * Copyright (C) 2002 Niels M�ller
 
8
 *  
 
9
 * The nettle library is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU Lesser General Public License as published by
 
11
 * the Free Software Foundation; either version 2.1 of the License, or (at your
 
12
 * option) any later version.
 
13
 * 
 
14
 * The nettle library is distributed in the hope that it will be useful, but
 
15
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
16
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
17
 * License for more details.
 
18
 * 
 
19
 * You should have received a copy of the GNU Lesser General Public License
 
20
 * along with the nettle library; see the file COPYING.LIB.  If not, write to
 
21
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
22
 * MA 02111-1307, USA.
 
23
 */
 
24
 
 
25
#if HAVE_CONFIG_H
 
26
# include "config.h"
 
27
#endif
 
28
 
 
29
#include <stdlib.h>
 
30
#include <stdio.h>
 
31
 
 
32
#include "realloc.h"
 
33
 
 
34
void *
 
35
nettle_realloc(void *ctx UNUSED, void *p, unsigned length)
 
36
{
 
37
  return realloc(p, length);
 
38
}
 
39
 
 
40
void *
 
41
nettle_xrealloc(void *ctx UNUSED, void *p, unsigned length)
 
42
{
 
43
  void *n = realloc(p, length);
 
44
  if (length && !n)
 
45
    {
 
46
      fprintf(stderr, "Virtual memory exhausted.\n");
 
47
      abort();
 
48
    }
 
49
  return n;
 
50
}