~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to lib/raster3d/alloc.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
#include <sys/types.h>
 
4
#include <unistd.h>
 
5
#include "raster3d_intern.h"
 
6
 
 
7
/*---------------------------------------------------------------------------*/
 
8
 
 
9
 
 
10
/*!
 
11
 * \brief 
 
12
 *
 
13
 *  Same as <em>malloc (nBytes)</em>, except that in case of error
 
14
 * <tt>Rast3d_error()</tt> is invoked.
 
15
 *
 
16
 *  \param nBytes
 
17
 *  \return void *: a pointer ... if successful,
 
18
 * NULL ... otherwise.
 
19
 
 
20
 */
 
21
 
 
22
void *Rast3d_malloc(int nBytes)
 
23
{
 
24
    void *buf;
 
25
 
 
26
    if (nBytes <= 0)
 
27
        nBytes = 1;
 
28
    if ((buf = malloc(nBytes)) != NULL)
 
29
        return buf;
 
30
 
 
31
    Rast3d_error("Rast3d_malloc: out of memory");
 
32
    return (void *)NULL;
 
33
}
 
34
 
 
35
 
 
36
/*!
 
37
 * \brief 
 
38
 *
 
39
 *  Same as <em>realloc (ptr, nBytes)</em>, except that in case of error
 
40
 *  <tt>Rast3d_error()</tt> is invoked. 
 
41
 *
 
42
 *  \param ptr
 
43
 *  \param nBytes
 
44
 *  \return void *: a pointer ... if successful,
 
45
 *         NULL ... otherwise.
 
46
 */
 
47
 
 
48
void *Rast3d_realloc(void *ptr, int nBytes)
 
49
{
 
50
    if (nBytes <= 0)
 
51
        nBytes = 1;
 
52
    if ((ptr = realloc(ptr, nBytes)) != NULL)
 
53
        return ptr;
 
54
 
 
55
    Rast3d_error("Rast3d_realloc: out of memory");
 
56
    return (void *)NULL;
 
57
}
 
58
 
 
59
 
 
60
/*!
 
61
 * \brief 
 
62
 *
 
63
 *  Same as <em>free (ptr)</em>.
 
64
 *
 
65
 *  \param buf
 
66
 *  \return void
 
67
 */
 
68
 
 
69
void Rast3d_free(void *buf)
 
70
{
 
71
    free(buf);
 
72
}