Revision r2565
Polymer: Fix a potential uninitialized mem read in debug msg when in void space.
Browse logs with clarity: filter by type/year, search text, and inspect parsed commit details.
Polymer: Fix a potential uninitialized mem read in debug msg when in void space.
Clean up astub.c in a similar fashion to the preceding changes.
Make g_grpNamePtr memory-clean, extern clearGrpNamePtr().
numgrpfiles --> NUMGRPFILES in Apple/GameListSource.game.m
Clear up handling of g_*NamePtr in the game.
The primary change is that things have been made memory-clean. Some of these
pointers may point to wildly different places during the course of the program
such as statically or dynamically allocated storage, the buffer returned by
getenv() (which must not be modified according to the docs), or an element of
argv[]. Consequently, we need to strdup, or better, dup_filename them if they
are ever to be passed to a function that modifies their pointed-to data.
Specifically:
- added statics or consts according to usage
- 3 new functions clear{Grp,Def,Script}NamePtr, only 'Def' one extern for now
- in G_CheckCommandLine, don't strip 'const'; use Bstrncpyz where appropriate
- remove multiple declarations
Also, warn if an application parameter has been ignored (not matched).
New helper function "char *dup_filename(const char *fn)" in common.h. It allocates a buffer of size BMAX_PATH and copies the passed string into it.
Replace various occurences of "Bstrncpy(buf, src, sz); buf[sz-1]=0;" with Bstrncpyz
Minor tweaks of makepalookup() and hicinit().
Replace {get,clear}filenames and duplicate autoload code in astub.c/game.c.
This additionally fixes leaks that were caused by traversing the file name
list with the 'findfiles' pointer and not clearing them afterwards (even if
there was a handle to the list head via 'findfileshigh').
Replace {get,clear}filenames with fnlist functions in build.c, menus.c and osdcmds.c
Factor out different {clear,get}filenames definitions into fnlist_t + functions.
Don't actually replace the instances in the code now.
Additions in common.h:
- fnlist_t, which combines CACHE1D_FIND_REC *finddirs, *findfiles and
int32_t numdirs, numfiles
- the FNLIST_INITIALIZER macro, which MUST be used for automatic variables
- fnlist_clearnames, fnlist_getnames functions
- G_LoadGroupsInDir, G_DoAutoload, two often-occurring uses of these
Factor out eleven (!) instances of identical code into check_file_exist().
Clean up defs.c a little. - remove redundant bound checks - add necessary bound checks - make one comparison pair consistent (> vs. >=) - one if-if --> clamp ------------------------------------------------------------------------
------------------------------------------------------------------------
r2566 | helixhorned | 2012-03-28 12:45:25 -0700 (Wed, 28 Mar 2012) | 1 line
The obligatory portion of trivial stuff.
------------------------------------------------------------------------
r2565 | helixhorned | 2012-03-28 12:45:05 -0700 (Wed, 28 Mar 2012) | 1 line
Polymer: Fix a potential uninitialized mem read in debug msg when in void space.
------------------------------------------------------------------------
r2564 | helixhorned | 2012-03-28 12:44:47 -0700 (Wed, 28 Mar 2012) | 1 line
Clean up astub.c in a similar fashion to the preceding changes.
------------------------------------------------------------------------
r2563 | helixhorned | 2012-03-28 12:44:33 -0700 (Wed, 28 Mar 2012) | 1 line
Make g_grpNamePtr memory-clean, extern clearGrpNamePtr().
------------------------------------------------------------------------
r2562 | helixhorned | 2012-03-28 12:44:14 -0700 (Wed, 28 Mar 2012) | 1 line
numgrpfiles --> NUMGRPFILES in Apple/GameListSource.game.m
------------------------------------------------------------------------
r2561 | helixhorned | 2012-03-28 12:44:00 -0700 (Wed, 28 Mar 2012) | 16 lines
Clear up handling of g_*NamePtr in the game.
The primary change is that things have been made memory-clean. Some of these
pointers may point to wildly different places during the course of the program
such as statically or dynamically allocated storage, the buffer returned by
getenv() (which must not be modified according to the docs), or an element of
argv[]. Consequently, we need to strdup, or better, dup_filename them if they
are ever to be passed to a function that modifies their pointed-to data.
Specifically:
- added statics or consts according to usage
- 3 new functions clear{Grp,Def,Script}NamePtr, only 'Def' one extern for now
- in G_CheckCommandLine, don't strip 'const'; use Bstrncpyz where appropriate
- remove multiple declarations
Also, warn if an application parameter has been ignored (not matched).
------------------------------------------------------------------------
r2560 | helixhorned | 2012-03-28 12:43:39 -0700 (Wed, 28 Mar 2012) | 3 lines
New helper function "char *dup_filename(const char *fn)" in common.h.
It allocates a buffer of size BMAX_PATH and copies the passed string into it.
------------------------------------------------------------------------
r2559 | helixhorned | 2012-03-28 12:43:21 -0700 (Wed, 28 Mar 2012) | 1 line
Replace various occurences of "Bstrncpy(buf, src, sz); buf[sz-1]=0;" with Bstrncpyz
------------------------------------------------------------------------
r2558 | helixhorned | 2012-03-28 12:42:49 -0700 (Wed, 28 Mar 2012) | 1 line
Minor tweaks of makepalookup() and hicinit().
------------------------------------------------------------------------
r2557 | helixhorned | 2012-03-28 12:42:32 -0700 (Wed, 28 Mar 2012) | 5 lines
Replace {get,clear}filenames and duplicate autoload code in astub.c/game.c.
This additionally fixes leaks that were caused by traversing the file name
list with the 'findfiles' pointer and not clearing them afterwards (even if
there was a handle to the list head via 'findfileshigh').
------------------------------------------------------------------------
r2556 | helixhorned | 2012-03-28 12:42:16 -0700 (Wed, 28 Mar 2012) | 1 line
Replace {get,clear}filenames with fnlist functions in build.c, menus.c and osdcmds.c
------------------------------------------------------------------------
r2555 | helixhorned | 2012-03-28 12:41:57 -0700 (Wed, 28 Mar 2012) | 9 lines
Factor out different {clear,get}filenames definitions into fnlist_t + functions.
Don't actually replace the instances in the code now.
Additions in common.h:
- fnlist_t, which combines CACHE1D_FIND_REC *finddirs, *findfiles and
int32_t numdirs, numfiles
- the FNLIST_INITIALIZER macro, which MUST be used for automatic variables
- fnlist_clearnames, fnlist_getnames functions
- G_LoadGroupsInDir, G_DoAutoload, two often-occurring uses of these
------------------------------------------------------------------------
r2554 | helixhorned | 2012-03-28 12:41:39 -0700 (Wed, 28 Mar 2012) | 1 line
Factor out eleven (!) instances of identical code into check_file_exist().
------------------------------------------------------------------------
r2553 | helixhorned | 2012-03-28 12:41:15 -0700 (Wed, 28 Mar 2012) | 6 lines
Clean up defs.c a little.
- remove redundant bound checks
- add necessary bound checks
- make one comparison pair consistent (> vs. >=)
- one if-if --> clamp
------------------------------------------------------------------------