~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/poppler/goo/gmem.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * gmem.h
 
3
 *
 
4
 * Memory routines with out-of-memory checking.
 
5
 *
 
6
 * Copyright 1996-2003 Glyph & Cog, LLC
 
7
 */
 
8
 
 
9
//========================================================================
 
10
//
 
11
// Modified under the Poppler project - http://poppler.freedesktop.org
 
12
//
 
13
// All changes made under the Poppler project to this file are licensed
 
14
// under GPL version 2 or later
 
15
//
 
16
// Copyright (C) 2005 Takashi Iwai <tiwai@suse.de>
 
17
// Copyright (C) 2007-2010 Albert Astals Cid <aacid@kde.org>
 
18
// Copyright (C) 2008 Jonathan Kew <jonathan_kew@sil.org>
 
19
//
 
20
// To see a description of the changes please see the Changelog file that
 
21
// came with your tarball or type make ChangeLog if you are building from git
 
22
//
 
23
//========================================================================
 
24
 
 
25
#ifndef GMEM_H
 
26
#define GMEM_H
 
27
 
 
28
#include <stdio.h>
 
29
#include "poppler/poppler-config.h"
 
30
 
 
31
#ifdef __cplusplus
 
32
extern "C" {
 
33
#endif
 
34
 
 
35
/*
 
36
 * Same as malloc, but prints error message and exits if malloc()
 
37
 * returns NULL.
 
38
 */
 
39
extern void *gmalloc(size_t size);
 
40
extern void *gmalloc_checkoverflow(size_t size);
 
41
 
 
42
/*
 
43
 * Same as realloc, but prints error message and exits if realloc()
 
44
 * returns NULL.  If <p> is NULL, calls malloc instead of realloc().
 
45
 */
 
46
extern void *grealloc(void *p, size_t size);
 
47
extern void *grealloc_checkoverflow(size_t size);
 
48
 
 
49
/*
 
50
 * These are similar to gmalloc and grealloc, but take an object count
 
51
 * and size.  The result is similar to allocating nObjs * objSize
 
52
 * bytes, but there is an additional error check that the total size
 
53
 * doesn't overflow an int.
 
54
 * The gmallocn_checkoverflow variant returns NULL instead of exiting
 
55
 * the application if a overflow is detected
 
56
 */
 
57
extern void *gmallocn(int nObjs, int objSize);
 
58
extern void *gmallocn_checkoverflow(int nObjs, int objSize);
 
59
extern void *gmallocn3(int a, int b, int c);
 
60
extern void *gmallocn3_checkoverflow(int a, int b, int c);
 
61
extern void *greallocn(void *p, int nObjs, int objSize);
 
62
extern void *greallocn_checkoverflow(void *p, int nObjs, int objSize);
 
63
 
 
64
/*
 
65
 * Same as free, but checks for and ignores NULL pointers.
 
66
 */
 
67
extern void gfree(void *p);
 
68
 
 
69
#ifdef DEBUG_MEM
 
70
/*
 
71
 * Report on unfreed memory.
 
72
 */
 
73
extern void gMemReport(FILE *f);
 
74
#else
 
75
#define gMemReport(f)
 
76
#endif
 
77
 
 
78
/*
 
79
 * Allocate memory and copy a string into it.
 
80
 */
 
81
extern char *copyString(char *s);
 
82
 
 
83
/*
 
84
 * Allocate memory and copy a limited-length string to it.
 
85
 */
 
86
extern char *gstrndup(const char *s, size_t n);
 
87
 
 
88
#ifdef __cplusplus
 
89
}
 
90
#endif
 
91
 
 
92
#endif