The Battle for Wesnoth  1.17.0+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.


#define lstring_c
#define LUA_CORE
#define MAXSTRTB   cast_int(luaM_limitN(MAX_INT, TString*))


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)
static void tablerehash (TString **vect, int osize, int nsize)
void luaS_resize (lua_State *L, int nsize)
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 void growstrtab (lua_State *L, stringtable *tb)
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, int nuvalue)

Macro Definition Documentation

◆ lstring_c

#define lstring_c

Definition at line 7 of file lstring.cpp.


#define LUA_CORE

Definition at line 8 of file lstring.cpp.


#define MAXSTRTB   cast_int(luaM_limitN(MAX_INT, TString*))

Definition at line 28 of file lstring.cpp.

Referenced by growstrtab().

Function Documentation

◆ createstrobj()

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

Definition at line 143 of file lstring.cpp.

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

Referenced by internshrstr(), and luaS_createlngstrobj().

◆ growstrtab()

static void growstrtab ( lua_State L,
stringtable tb 

◆ internshrstr()

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

◆ luaS_clearcache()

void luaS_clearcache ( global_State g)

Definition at line 110 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 157 of file lstring.cpp.

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

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

◆ luaS_eqlngstr()

int luaS_eqlngstr ( TString a,
TString b 

Definition at line 34 of file lstring.cpp.

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

Referenced by equalkey(), and luaV_equalobj().

◆ luaS_hash()

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

Definition at line 43 of file lstring.cpp.

References cast_byte, cast_uint, and h.

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

◆ luaS_hashlongstr()

unsigned int luaS_hashlongstr ( TString ts)

Definition at line 51 of file lstring.cpp.

References TString::extra, getstr, TString::hash, TString::lnglen, lua_assert, LUA_VLNGSTR, 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,
int  nuvalue 

◆ luaS_remove()

void luaS_remove ( lua_State L,
TString ts 

Definition at line 164 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  nsize 

Definition at line 85 of file lstring.cpp.

References G, stringtable::hash, luaM_reallocvector, stringtable::size, tablerehash(), and unlikely.

Referenced by checkSizes(), and growstrtab().

◆ tablerehash()

static void tablerehash ( TString **  vect,
int  osize,
int  nsize 

Definition at line 62 of file lstring.cpp.

References h, TString::hash, TString::hnext, i, lmod, p, and TString::u.

Referenced by luaS_init(), and luaS_resize().