Work around incomplete C11 support in Microsoft's stddef.h Closes https://github.com/DarkPlacesEngine/darkplaces/issues/126 Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
cvar: fix many bugs in gamedir, loadconfig, unset, cvar_resettodefaults* commands Fixes a segfault when Cvar_RestoreInitState() deleted cvars (null ptr deref). Fixes an infinite loop in Host_LoadConfig_f() due to calling Cbuf_Execute() from inside Cbuf_Execute() via Host_AddConfigText(). Fixes `unset` being able to delete autocvars while they're in use by QC. Fixes Cvar_RestoreInitState() not updating autocvars when necessary. Fixes Cvar_RestoreInitState() not calling cvar callbacks. Fixes Cvar_RestoreInitState() sometimes restoring such that .string doesn't match .value, or such that .defstring is wrong. This was caused by Cvar_SaveInitState() saving only string pointers and not strings. Fixes CF_READONLY cvars like gl_info_* getting restored/reset. It doesn't make sense for any of these to be changed by code outside their own subsystems. Fixes Xonotic menu QC errors caused by Host_LoadConfig_f deleting cvars before calling QC's m_shutdown(). Deduplicates and simplifies cvar deletion code, see also 05a5ed884366d3a1c8e211168efc19b61867cfca Saves a little memory by storing only minimal init state data for Cvar_RestoreInitState(), and by relaxing alignment requirements in _Mem_strdup(). Improves some warns and docs and tidies up a little. Removes `vid_restart` from `gamedir`, it usually isn't needed because current DP applies many vid_ cvar changes without it, and because of the ubiquity of flat panel displays. Fixes https://gitlab.com/xonotic/darkplaces/-/issues/354 Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Update and micro-optimise memory allocation The max alignment requirement no longer needs to be hard-coded. We were allocating slightly more than necessary for alignment padding. Makes a (currently unused) macro more useful and robust. Fixes bitfield data type. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
zone: Use the generic linked list
zone: Pass __FILE__ and __LINE__ to Mem_strdup Made it a macro for _Mem_strdup which is what Mem_strdup was. We have to call _Mem_Alloc directly to pass __FILE__ and __LINE__ to that function.
zone: Add Z_ counterparts for Realloc and strdup
Add qdefs.h and qstats.h to split up quakedef.h. Make a lot of headers standalone-compilable. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12961 d7cf8633-e32d-0410-b094-e92efae38249
Rename qboolean to qbool git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12920 d7cf8633-e32d-0410-b094-e92efae38249
host: Major refactor * Split up Host_Main. Implemented Host_Frame (which is now most of what Host_Main was), and moved timekeeping and sleep code to the new Host_Main. * Moved all server frame code to the new SV_Frame. * Fixed sleep behavior. A dedicated server should sleep again. * General cleanup. New functions to split things up and keep things readable. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12844 d7cf8633-e32d-0410-b094-e92efae38249
Added developer_memorylargerthanmb cvar which prints (with developer 1) notices about very large memory allocations (16MB and larger by default). Slightly improved the Mem_Alloc out of memory error to include the size of the failed allocation. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12292 d7cf8633-e32d-0410-b094-e92efae38249
Rollback last change which was meant to be many smaller pieces. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12291 d7cf8633-e32d-0410-b094-e92efae38249
Added developer_memorylargerthanmb cvar which dprints notices about very large memory allocations (16MB and larger by default). Slightly improved the Mem_Alloc out of memory error to include the size of the failed allocation. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12290 d7cf8633-e32d-0410-b094-e92efae38249
Rewritten SVQC stringbuffer saving routines (which is part of yet unfinished databuffers extension). Changes are backwards compatible with old savefile format. Now, once saved stringbuffers are found in extended savegame section, all string buffers allocated by worldspawn()/entityspawn (which is processed prior to savegame parsing) are deleted, and stringbuffers are restored from savegamefile with their original handles. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11930 d7cf8633-e32d-0410-b094-e92efae38249
Experimental feature of saving buffers within savegame files (in extended section). Code needs cleaning (since i'm not really understand concept of expandable arrays). Upgraded buf_create() to optional buf_create(string,float) string being a buffer format (yet another experimental feature that will be tested in future), should be "string" if presented. Second float is buffer flags, currently only flag 1 (save in savegames) are used. There is idea for another buffer flag which will allow buffer to pass across levels, saving handle number and contents (bufhandle could be passed as one of parm*). git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9949 d7cf8633-e32d-0410-b094-e92efae38249
added mem_bigendian variable made LittleLong/Short/Float and BigLong/Short/Float functions pass a pointer to the variable to BuffBigLong/BuffLittleLong and friends to avoid unaligned memory access crashes on some platforms even if a file has unaligned data in it added StoreBigLong function to help the netconn.c code removed BYTE_ORDER compile-time detection git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9617 d7cf8633-e32d-0410-b094-e92efae38249
added Mem_Memalign function added Mem_Realloc function git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9528 d7cf8633-e32d-0410-b094-e92efae38249
rewrote clump allocation system, added an experimental global clump (note: clumping is still not on by default, and probably never will be) reworked sentinel code to always use the MEMPARANOIA approach (address-dependent sentinels) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9483 d7cf8633-e32d-0410-b094-e92efae38249
improving MEMCLUMP handling git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9462 d7cf8633-e32d-0410-b094-e92efae38249
for now, turn off MEMPARANOIA git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9102 d7cf8633-e32d-0410-b094-e92efae38249
MUCH more paranoid memory checking (use random address dependent sentinels) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9020 d7cf8633-e32d-0410-b094-e92efae38249