The Battle for Wesnoth  1.15.2+dev
Macros | Functions
lstring.cpp File Reference
#include "lprefix.h"
#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
#include "lstring.h"
Include dependency graph for lstring.cpp:

Go to the source code of this file.

Macros

#define lstring_c
 
#define LUA_CORE
 
#define MEMERRMSG   "not enough memory"
 
#define LUAI_HASHLIMIT   5
 

Functions

int luaS_eqlngstr (TString *a, TString *b)
 
unsigned int luaS_hash (const char *str, size_t l, unsigned int seed)
 
unsigned int luaS_hashlongstr (TString *ts)
 
void luaS_resize (lua_State *L, int newsize)
 
void luaS_clearcache (global_State *g)
 
void luaS_init (lua_State *L)
 
static TStringcreatestrobj (lua_State *L, size_t l, int tag, unsigned int h)
 
TStringluaS_createlngstrobj (lua_State *L, size_t l)
 
void luaS_remove (lua_State *L, TString *ts)
 
static TStringinternshrstr (lua_State *L, const char *str, size_t l)
 
TStringluaS_newlstr (lua_State *L, const char *str, size_t l)
 
TStringluaS_new (lua_State *L, const char *str)
 
UdataluaS_newudata (lua_State *L, size_t s)
 

Macro Definition Documentation

◆ lstring_c

#define lstring_c

Definition at line 7 of file lstring.cpp.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lstring.cpp.

◆ LUAI_HASHLIMIT

#define LUAI_HASHLIMIT   5

Definition at line 33 of file lstring.cpp.

Referenced by luaS_hash().

◆ MEMERRMSG

#define MEMERRMSG   "not enough memory"

Definition at line 25 of file lstring.cpp.

Referenced by luaS_init().

Function Documentation

◆ createstrobj()

static TString* createstrobj ( lua_State L,
size_t  l,
int  tag,
unsigned int  h 
)
static

Definition at line 133 of file lstring.cpp.

References TString::extra, gco2ts, getstr, h, TString::hash, luaC_newobj(), and sizelstring.

Referenced by internshrstr(), and luaS_createlngstrobj().

◆ internshrstr()

static TString* internshrstr ( lua_State L,
const char *  str,
size_t  l 
)
static

◆ luaS_clearcache()

void luaS_clearcache ( global_State g)

Definition at line 103 of file lstring.cpp.

References i, iswhite, global_State::memerrmsg, global_State::strcache, STRCACHE_M, and STRCACHE_N.

Referenced by atomic().

◆ luaS_createlngstrobj()

TString* luaS_createlngstrobj ( lua_State L,
size_t  l 
)

Definition at line 147 of file lstring.cpp.

References createstrobj(), G, TString::lnglen, LUA_TLNGSTR, and TString::u.

Referenced by LoadString(), luaS_newlstr(), and luaV_concat().

◆ luaS_eqlngstr()

int luaS_eqlngstr ( TString a,
TString b 
)

Definition at line 40 of file lstring.cpp.

References getstr, TString::lnglen, lua_assert, LUA_TLNGSTR, and TString::u.

Referenced by luaV_equalobj().

◆ luaS_hash()

unsigned int luaS_hash ( const char *  str,
size_t  l,
unsigned int  seed 
)

Definition at line 49 of file lstring.cpp.

References cast, cast_byte, h, and LUAI_HASHLIMIT.

Referenced by internshrstr(), luaS_hashlongstr(), and makeseed().

◆ luaS_hashlongstr()

unsigned int luaS_hashlongstr ( TString ts)

Definition at line 58 of file lstring.cpp.

References TString::extra, getstr, TString::hash, TString::lnglen, lua_assert, LUA_TLNGSTR, luaS_hash(), and TString::u.

Referenced by mainposition().

◆ luaS_init()

void luaS_init ( lua_State L)

◆ luaS_new()

TString* luaS_new ( lua_State L,
const char *  str 
)

◆ luaS_newlstr()

TString* luaS_newlstr ( lua_State L,
const char *  str,
size_t  l 
)

◆ luaS_newudata()

Udata* luaS_newudata ( lua_State L,
size_t  s 
)

◆ luaS_remove()

void luaS_remove ( lua_State L,
TString ts 
)

Definition at line 154 of file lstring.cpp.

References G, stringtable::hash, TString::hash, TString::hnext, lmod, stringtable::nuse, p, stringtable::size, and TString::u.

Referenced by freeobj().

◆ luaS_resize()

void luaS_resize ( lua_State L,
int  newsize 
)