@@ -322,7 +322,8 @@ void *poolFixedMalloc(long size /* bytes */);
322
322
* the given size is allocated from the system. In any case, the header of the
323
323
* \ref block is properly initialized. Exits program on out of memory
324
324
* condition.
325
- * \param[in] size (in bytes) of the block, not including the block header.
325
+ * \param[in] size (in bytes) of the block, not including the block header, but
326
+ * including space for a terminal NULL.
326
327
* \return a free and initialized block of memory with at least the requested
327
328
* user space. Exit on out-of-memory
328
329
*/
@@ -336,11 +337,14 @@ void *poolMalloc(long size /* bytes */);
336
337
* added.
337
338
* \param[in] ptr pointer to a \ref block.
338
339
* \pre
339
- * all memory pointed to by \p ptr is considered free. This holds even if it
340
- * it is kept in \ref memUsedPool.
340
+ * - \p ptr was previously allocated.
341
+ * - all memory pointed to by \p ptr is considered free. This holds even if it
342
+ * it is kept in \ref memUsedPool.
341
343
* \post
342
344
* - \ref poolTotalFree is updated
343
345
* - Exit on out-of-memory (the \ref memFreePool overflows)
346
+ * \attention never submit a \p ptr referring to memory not on the heap, like
347
+ * NULL_PTRSTRING.
344
348
*/
345
349
void poolFree (void * ptr );
346
350
/*!
@@ -410,7 +414,7 @@ long getFreeSpace(long max);
410
414
411
415
/* Fatal memory allocation error */
412
416
/*!
413
- * \fn outOfMemory(const char *msg)
417
+ * \fn void outOfMemory(const char *msg)
414
418
* \brief exit after fatal memory allocation error.
415
419
*
416
420
* called when memory cannot be allocated, either because memory/address space
@@ -428,7 +432,7 @@ void outOfMemory(const char *msg);
428
432
429
433
/* Bug check error */
430
434
/*!
431
- * \fn bug(int bugNum)
435
+ * \fn void bug(int bugNum)
432
436
*/
433
437
void bug (int bugNum );
434
438
@@ -707,21 +711,31 @@ temp_pntrString *pntrMakeTempAlloc(pntrString *s);
707
711
/* String assignment - MUST be used to assign vstrings */
708
712
/*!
709
713
* \fn void pntrLet(pntrString **target, const pntrString *source)
714
+ * Copies the \ref pntrString elements of \p source to the beginning of a
715
+ * \ref block referenced by \p target. If necessary, the \p target block is
716
+ * reallocated, and if it is, it gets twice the needed size to account for
717
+ * future growing. If the \p target block is only partially used after copy it
718
+ * is added to the \ref memUsedPool. If \p source is empty, the \p target is
719
+ *
710
720
* \param[in,out] target (not null) the address of a pointer pointing to the
711
- * first byte of a \ref block receiving the copied \p source.
721
+ * first byte of a \ref block receiving the copied elements of \p source.
712
722
* \param[in] source (not null) a pointer to the first \ref pntrString element
713
723
* in a \ref block, to be copied from.
714
724
* \pre
715
725
* - source does not contain NULL pointer, but is terminated by one. This
716
726
* NULL pointer is not part of the array, but must be present.
717
- * - the target \ref block does not contain used data.
727
+ * - the target \ref block does not contain any valuable data.
718
728
* \post
719
729
* - the \ref block \p target points to is filled with a copy of
720
730
* \ref pntrString elements \p source points to, padded with a terminal
721
731
* NULL.
722
- * - Exit on out-of-memory
723
732
* - due to a possible reallocation the pointer \p target points to may
724
733
* change.
734
+ * - updates \ref db3 and \ref poolTotalFree.
735
+ * - Exit on out-of-memory
736
+ * \bug If the \p target block is full after the copy operation, it is not
737
+ * necessarily removed from the \ref memUsedPool, although other
738
+ * functions like \ref addToUsedPool do not support this.
725
739
*/
726
740
void pntrLet (pntrString * * target , const pntrString * source );
727
741
@@ -751,9 +765,10 @@ temp_pntrString *pntrPSpace(long n);
751
765
* dedicated to it.
752
766
*
753
767
* returns the number of **reserved** pointers in the array pointed to by \p s,
754
- * derived solely from administrative data in the surrounding \ref block. NULL
755
- * pointer in the array are included, a trailing one is not required to
756
- * determine the length.´
768
+ * derived solely from administrative data in the surrounding \ref block. Thus,
769
+ * the value is valid, even if data has not yet been transferred to the
770
+ * reserved space, and the terminal NULL is not safely recognized. The returned
771
+ * value excludes the space set aside for a terminal NULL.
757
772
*
758
773
* \attention This is not the capacity of the array.
759
774
* \param[in] s points to a element 0 of a \ref pntrString embedded in a block
0 commit comments