misc/liblua/lmem.h
author Wuzzy <Wuzzy2@mail.ru>
Mon, 13 Nov 2017 22:14:45 +0100
changeset 12841 8610462e3d33
parent 10017 de822cd3df3a
permissions -rw-r--r--
Remove 2 unused number tags in Construction Mode GUI These numbers are shown aside the power tag, but the numbers never change. They don't serve any purpose and are just visual clutter and annoying, since they partially overlap. They are probably a leftover from copying code over from other scripts. With this changeset, only the power and turn time are left visible, as it is supposed to.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     1
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     2
** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     3
** Interface to Memory Manager
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     4
** See Copyright Notice in lua.h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     5
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     7
#ifndef lmem_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     8
#define lmem_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     9
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    10
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    11
#include <stddef.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    12
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    13
#include "llimits.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    14
#include "lua.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    15
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    16
#define MEMERRMSG   "not enough memory"
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    17
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    18
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    19
#define luaM_reallocv(L,b,on,n,e) \
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    20
    ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ?  /* +1 to avoid warnings */ \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    21
        luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    22
        luaM_toobig(L))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    23
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    24
#define luaM_freemem(L, b, s)   luaM_realloc_(L, (b), (s), 0)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    25
#define luaM_free(L, b)     luaM_realloc_(L, (b), sizeof(*(b)), 0)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    26
#define luaM_freearray(L, b, n, t)   luaM_reallocv(L, (b), n, 0, sizeof(t))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    27
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    28
#define luaM_malloc(L,t)    luaM_realloc_(L, NULL, 0, (t))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    29
#define luaM_new(L,t)       cast(t *, luaM_malloc(L, sizeof(t)))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    30
#define luaM_newvector(L,n,t) \
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    31
        cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    32
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    33
#define luaM_growvector(L,v,nelems,size,t,limit,e) \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    34
          if ((nelems)+1 > (size)) \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    35
            ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    36
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    37
#define luaM_reallocvector(L, v,oldn,n,t) \
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    38
   ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    39
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    40
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    41
LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    42
                                                          size_t size);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    43
LUAI_FUNC void *luaM_toobig (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    44
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    45
                               size_t size_elem, int limit,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    46
                               const char *errormsg);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    47
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    48
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    49