Improve comments

This commit is contained in:
Behdad Esfahbod 2010-04-21 00:49:40 -04:00
parent 394bad41a7
commit 40d73bc68d
1 changed files with 14 additions and 8 deletions

View File

@ -523,11 +523,14 @@ struct GenericArrayOf
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false; if (!SANITIZE_GET_SIZE()) return false;
/* Note: /* Note: for structs that do not reference other structs,
* for non-recursive types, this is not much needed. * we do not need to call their sanitize() as we already did
* But we keep the code to make sure the objects pointed to * a bound check on the aggregate array size, hence the return.
* do have a simple sanitize(). */ */
return true; return true;
/* We do keep this code though to make sure the structs pointed
* to do have a simple sanitize(), ie. they do not reference
* other structs. */
unsigned int count = len; unsigned int count = len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (!SANITIZE (array()[i])) if (!SANITIZE (array()[i]))
@ -626,11 +629,14 @@ struct HeadlessArrayOf
inline bool sanitize (SANITIZE_ARG_DEF) { inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!SANITIZE_GET_SIZE()) return false; if (!SANITIZE_GET_SIZE()) return false;
/* Note: /* Note: for structs that do not reference other structs,
* for non-recursive types, this is not much needed. * we do not need to call their sanitize() as we already did
* But we keep the code to make sure the objects pointed to * a bound check on the aggregate array size, hence the return.
* do have a simple sanitize(). */ */
return true; return true;
/* We do keep this code though to make sure the structs pointed
* to do have a simple sanitize(), ie. they do not reference
* other structs. */
unsigned int count = len ? len - 1 : 0; unsigned int count = len ? len - 1 : 0;
Type *a = array(); Type *a = array();
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)