OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
allocate2d.h File Reference
#include <stddef.h>
Include dependency graph for allocate2d.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char ** allocate2d_char (size_t h, size_t w)
 
void free2d_char (char **p)
 
void free2d_all_char (char **p, size_t length)
 
unsigned char ** allocate2d_uchar (size_t h, size_t w)
 
void free2d_uchar (unsigned char **p)
 
void free2d_all_uchar (unsigned char **p, size_t length)
 
signed char ** allocate2d_schar (size_t h, size_t w)
 
void free2d_schar (signed char **p)
 
void free2d_all_schar (signed char **p, size_t length)
 
short ** allocate2d_short (size_t h, size_t w)
 
void free2d_short (short **p)
 
void free2d_all_short (short **p, size_t length)
 
float ** allocate2d_float (size_t h, size_t w)
 
void free2d_float (float **p)
 
void free2d_all_float (float **p, size_t length)
 
double ** allocate2d_double (size_t h, size_t w)
 
void free2d_double (double **p)
 
void free2d_all_double (double **p, size_t length)
 

Detailed Description

Utility functions for allocating and freeing two-dimensional arrays of various types.

This file was created by allocate2d.pl and should not be edited manually.

Definition in file allocate2d.h.

Function Documentation

◆ allocate2d_char()

char** allocate2d_char ( size_t  h,
size_t  w 
)

Allocate a two-dimensional array of type char of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

char **array = allocate2d_char(5, 1); printf("%d\n", array[4][0]);

Parameters
[in]hHeight of array.
[in]wWidth of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 13 of file allocate2d.c.

◆ allocate2d_double()

double** allocate2d_double ( size_t  h,
size_t  w 
)

Allocate a two-dimensional array of type double of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

double **array = allocate2d_double(5, 1); printf("%d\n", array[4][0]);

Parameters
[in]hHeight of array.
[in]wWidth of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 153 of file allocate2d.c.

◆ allocate2d_float()

float** allocate2d_float ( size_t  h,
size_t  w 
)

Allocate a two-dimensional array of type float of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

float **array = allocate2d_float(5, 1); printf("%d\n", array[4][0]);

Parameters
[in]hHeight of array.
[in]wWidth of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 125 of file allocate2d.c.

◆ allocate2d_schar()

signed char** allocate2d_schar ( size_t  h,
size_t  w 
)

Allocate a two-dimensional array of type signed char of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

signed char **array = allocate2d_schar(5, 1); printf("%d\n", array[4][0]);

Parameters
[in]hHeight of array.
[in]wWidth of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 69 of file allocate2d.c.

◆ allocate2d_short()

short** allocate2d_short ( size_t  h,
size_t  w 
)

Allocate a two-dimensional array of type short of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

short **array = allocate2d_short(5, 1); printf("%d\n", array[4][0]);

Parameters
[in]hHeight of array.
[in]wWidth of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 97 of file allocate2d.c.

◆ allocate2d_uchar()

unsigned char** allocate2d_uchar ( size_t  h,
size_t  w 
)

Allocate a two-dimensional array of type unsigned char of a given size.

The order of the parameters are (now) the same as when the data is being accessed. E.g., this is valid (ignoring the printf type specifier):

unsigned char **array = allocate2d_uchar(5, 1); printf("%d\n", array[4][0]);

Parameters
[in]hHeight of array.
[in]wWidth of array.
Returns
A malloc'd array or NULL if any malloc fails.

Definition at line 41 of file allocate2d.c.

◆ free2d_all_char()

void free2d_all_char ( char **  p,
size_t  length 
)

Free a two-dimensional array created by malloc'ing each row individually.

Parameters
[in]pPointer to array to free.
[in]lengthLength of input array's first dimension.

Definition at line 34 of file allocate2d.c.

◆ free2d_all_double()

void free2d_all_double ( double **  p,
size_t  length 
)

Free a two-dimensional array created by malloc'ing each row individually.

Parameters
[in]pPointer to array to free.
[in]lengthLength of input array's first dimension.

Definition at line 174 of file allocate2d.c.

◆ free2d_all_float()

void free2d_all_float ( float **  p,
size_t  length 
)

Free a two-dimensional array created by malloc'ing each row individually.

Parameters
[in]pPointer to array to free.
[in]lengthLength of input array's first dimension.

Definition at line 146 of file allocate2d.c.

◆ free2d_all_schar()

void free2d_all_schar ( signed char **  p,
size_t  length 
)

Free a two-dimensional array created by malloc'ing each row individually.

Parameters
[in]pPointer to array to free.
[in]lengthLength of input array's first dimension.

Definition at line 90 of file allocate2d.c.

◆ free2d_all_short()

void free2d_all_short ( short **  p,
size_t  length 
)

Free a two-dimensional array created by malloc'ing each row individually.

Parameters
[in]pPointer to array to free.
[in]lengthLength of input array's first dimension.

Definition at line 118 of file allocate2d.c.

◆ free2d_all_uchar()

void free2d_all_uchar ( unsigned char **  p,
size_t  length 
)

Free a two-dimensional array created by malloc'ing each row individually.

Parameters
[in]pPointer to array to free.
[in]lengthLength of input array's first dimension.

Definition at line 62 of file allocate2d.c.

◆ free2d_char()

void free2d_char ( char **  p)

Free a two-dimensional array created by allocate2d_char.

Parameters
[in]pPointer to array created by allocate2d_char.

Definition at line 30 of file allocate2d.c.

◆ free2d_double()

void free2d_double ( double **  p)

Free a two-dimensional array created by allocate2d_double.

Parameters
[in]pPointer to array created by allocate2d_double.

Definition at line 170 of file allocate2d.c.

◆ free2d_float()

void free2d_float ( float **  p)

Free a two-dimensional array created by allocate2d_float.

Parameters
[in]pPointer to array created by allocate2d_float.

Definition at line 142 of file allocate2d.c.

◆ free2d_schar()

void free2d_schar ( signed char **  p)

Free a two-dimensional array created by allocate2d_schar.

Parameters
[in]pPointer to array created by allocate2d_schar.

Definition at line 86 of file allocate2d.c.

◆ free2d_short()

void free2d_short ( short **  p)

Free a two-dimensional array created by allocate2d_short.

Parameters
[in]pPointer to array created by allocate2d_short.

Definition at line 114 of file allocate2d.c.

◆ free2d_uchar()

void free2d_uchar ( unsigned char **  p)

Free a two-dimensional array created by allocate2d_uchar.

Parameters
[in]pPointer to array created by allocate2d_uchar.

Definition at line 58 of file allocate2d.c.