spBase
読み取り中…
検索中…
一致する文字列を見つけられません
spMemory.h
[詳解]
1
4#ifndef __SPMEMORY_H
5#define __SPMEMORY_H
6
7#include <sp/spDefs.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
16 /*----@addtogroup spMemoryGroup----*/
17
18#ifdef MACOS
19#undef SP_USE_MAC_MEMORY
20#endif
21
22#if defined(MACOS)
23#pragma import on
24#endif
25
26extern void spSetMemoryErrorExit(int flag);
28extern char *xspMalloc(int nbytes);
30extern char *xspRemalloc(char *p, int nbytes);
32extern void _xspFree(char *p);
33
35extern int **xspIMatAlloc(int row, int col);
37extern void xspIMatFree(int **mat, int row);
39extern short **xspSMatAlloc(int row, int col);
41extern void xspSMatFree(short **mat, int row);
43extern long **xspLMatAlloc(int row, int col);
45extern void xspLMatFree(long **mat, int row);
47extern float **xspFMatAlloc(int row, int col);
49extern void xspFMatFree(float **mat, int row);
51extern double **xspDMatAlloc(int row, int col);
53extern void xspDMatFree(double **mat, int row);
54
56extern char **xspCMatAlloc(int row, int col);
58extern void xspCMatFree(char **mat, int row);
60extern unsigned char **xspUCMatAlloc(int row, int col);
62extern void xspUCMatFree(unsigned char **mat, int row);
63
65extern char *xspStrClone(const char *string);
66
67#if defined(MACOS)
68#pragma import off
69#endif
70
71#if defined(_WIN32) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
72#define xspAlloc(n, type) (type *)malloc((int)(n)*sizeof(type))
73#define xspRealloc(p, n, type) (type *)realloc((char *)(p), (int)(n)*sizeof(type))
74#define xspFree(p) {free((char *)(p)); (p) = NULL;}
75#define xspStrClone(p) _strdup(p)
76#else
78#define xspAlloc(n, type) (type *)xspMalloc((int)(n)*sizeof(type))
80#define xspRealloc(p, n, type) (type *)xspRemalloc((char *)(p), (int)(n)*sizeof(type))
82#define xspFree(p) {_xspFree((char *)(p)); (p) = NULL;}
83#endif
84
85 /*----@addtogroup spMemoryGroup----*/
86
87#define spStrReplace(s1, s2) {if ((s1) != NULL) xspFree(s1); (s1) = (((s2) != NULL) ? xspStrClone(s2) : NULL);}
88#define spArrayCopy(p1, p2, n, type) memmove((char *)(p1), (char *)(p2), (unsigned)(n)*sizeof(type))
89
90#if !defined(SP_DISABLE_ABBREVIATION)
91#ifndef xalloc
92#define xalloc xspAlloc
93#endif
94#ifndef xrealloc
95#define xrealloc xspRealloc
96#endif
97#ifndef xfree
98#define xfree xspFree
99#endif
100
101#ifndef strclone
102#define strclone xspStrClone
103#endif
104#ifndef strrepl
105#define strrepl spStrReplace
106#endif
107#ifndef arrcpy
108#define arrcpy spArrayCopy
109#endif
110#endif /* !defined(SP_DISABLE_ABBREVIATION) */
111
112#ifdef __cplusplus
113} /* Close scope of 'extern "C"' declaration */
114#endif
115
116#endif /* __SPMEMORY_H */
float ** xspFMatAlloc(int row, int col)
void xspUCMatFree(unsigned char **mat, int row)
void xspIMatFree(int **mat, int row)
char * xspStrClone(const char *string)
void _xspFree(char *p)
void xspCMatFree(char **mat, int row)
void xspDMatFree(double **mat, int row)
long ** xspLMatAlloc(int row, int col)
double ** xspDMatAlloc(int row, int col)
short ** xspSMatAlloc(int row, int col)
void xspLMatFree(long **mat, int row)
void xspSMatFree(short **mat, int row)
char * xspRemalloc(char *p, int nbytes)
unsigned char ** xspUCMatAlloc(int row, int col)
char * xspMalloc(int nbytes)
void xspFMatFree(float **mat, int row)
char ** xspCMatAlloc(int row, int col)
int ** xspIMatAlloc(int row, int col)