NASA Logo
Ocean Color Science Software

ocssw V2022
allocate2d.c File Reference
#include "allocate2d.h"
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for allocate2d.c:

Go to the source code of this file.

Functions

char ** allocate2d_char (size_t h, size_t w)
 
void free2d_char (char **p)
 
unsigned char ** allocate2d_uchar (size_t h, size_t w)
 
void free2d_uchar (unsigned char **p)
 
signed char ** allocate2d_schar (size_t h, size_t w)
 
void free2d_schar (signed char **p)
 
short ** allocate2d_short (size_t h, size_t w)
 
void free2d_short (short **p)
 
int ** allocate2d_int (size_t h, size_t w)
 
void free2d_int (int **p)
 
float ** allocate2d_float (size_t h, size_t w)
 
void free2d_float (float **p)
 
double ** allocate2d_double (size_t h, size_t w)
 
void free2d_double (double **p)
 

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.c.

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 145 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 123 of file allocate2d.c.

◆ allocate2d_int()

int** allocate2d_int ( size_t  h,
size_t  w 
)

Allocate a two-dimensional array of type int 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):

int **array = allocate2d_int(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 101 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 57 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 79 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 35 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 162 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 140 of file allocate2d.c.

◆ free2d_int()

void free2d_int ( int **  p)

Free a two-dimensional array created by allocate2d_int.

Parameters
[in]pPointer to array created by allocate2d_int.

Definition at line 118 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 74 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 96 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 52 of file allocate2d.c.