File: auto_array.h

package info (click to toggle)
hx 0.7.10-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 564 kB
  • ctags: 834
  • sloc: ansic: 7,900; sh: 152; makefile: 84
file content (14 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef _AUTO_ARRAY_H
#define _AUTO_ARRAY_H 1

#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define auto_array(_str, _name, _siz) \
	char _name[_siz + 1]; memcpy(_name, _str, _siz); _name[_siz] = 0;
#define auto_free(_str)
#else
#define auto_array(_str, _name, _siz) \
	char *_name = xmalloc(_siz + 1); memcpy(_name, _str, _siz); _name[_siz] = 0;
#define auto_free(_str) xfree(_str);
#endif

#endif /* !_AUTO_ARRAY_H */