Skip to content

Commit 515fec4

Browse files
committed
fix doc of let
1 parent 42fa455 commit 515fec4

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/mmdata.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ temp_pntrString *pntrMakeTempAlloc(pntrString *s);
728728
* reallocated, and if it is, it gets twice the needed size to account for
729729
* future growing. If the \p target block is only partially used after copy it
730730
* is added to the \ref memUsedPool. If \p source is empty, the \p target is
731-
* to \ref NULL_PNTRSTRING.
731+
* set to \ref NULL_PNTRSTRING.
732732
* \n
733733
* It is assumed that the value persisted in \p target is in fact computed from
734734
* temporary operands in \ref pntrTempAllocStack. All blocks starting with
@@ -745,7 +745,7 @@ temp_pntrString *pntrMakeTempAlloc(pntrString *s);
745745
* - source does not contain NULL pointer elements , but is terminated by
746746
* one. This final NULL pointer is not part of the array, but must be present.
747747
* - the target \ref block does not contain any valuable data.
748-
* - all \ref pntrString elements held in \ref pntrTempAllocStack can be
748+
* - all \ref pntrString elements freed in \ref pntrTempAllocStack can be
749749
* discarded without losing relevant references.
750750
* \post
751751
* - the \ref block \p target points to is filled with a copy of

src/mmvstr.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ typedef vstring temp_vstring;
259259
* directly to avoid buildup of temporary strings.
260260
*
261261
* \pre
262-
* \ref g_startTempAllocStack is the index in \ref tempAllocStack from which
263-
* on enties are freed.
262+
* All references freed in \ref tempAllocStack can be safely discarded
263+
* without risking a memory leak.
264264
* \post
265265
* - Entries in \ref tempAllocStack from index \ref g_startTempAllocStack on
266266
* are freed. The top of stack \ref g_tempAllocStackTop is back to
@@ -283,31 +283,28 @@ void freeTempAlloc(void);
283283
* again. Every entry on and beyond \ref g_startTempAllocStack is considered
284284
* to be consumed and subject to deallocation.
285285
*
286-
* This deallocation procedure is embedded in this operation, since frequently
287-
* the final string was composed of some fragments, that now can be disposed
288-
* of. In fact, this function must ALWAYS be called to assign to a vstring in
289-
* order for the memory cleanup routines, etc. to work properly. A new vstring
286+
* This deallocation procedure is embedded in this operation, since often the
287+
* final string is composed of some fragments, that now can be disposed of. In
288+
* fact, this function must ALWAYS be called to assign to a vstring in order
289+
* for the memory cleanup routines, etc. to work properly. A new vstring
290290
* should be initialized to "" (the empty string), and the \ref vstring_def
291291
* macro handles creation of such variables.
292292
*
293293
* Possible failures: Out of memory condition.
294294
*
295-
* \param[out] target (not null) address of a \ref vstring receiving a copy of
295+
* \param[in,out] target (not null) address of a \ref vstring receiving a copy of
296296
* the source string. Its current value, if not empty, must never point to a
297-
* true portion of another \ref vstring. It must not coincide with any of
298-
* the temporary strings in \ref tempAllocStack, from index
299-
* \ref g_startTempAllocStack on. You can assign to an entry with index
300-
* below this value, though.
297+
* true tail of another \ref vstring. You must not assign to any of the
298+
* temporary strings in \ref tempAllocStack.
301299
* \param[in] source (not null) NUL terminated string to be copied from.
302300
*
303301
* \pre
304302
* - \ref g_startTempAllocStack contains the starting index of entries in
305303
* \ref tempAllocStack, that is going to be deallocated.
306-
* - both parameters are not null and point to NUL terminated strings.
307304
* - The destination of this function must either be empty, or uniquely point
308305
* to a \ref vstring, but not any of the \ref temp_vstring;
309306
* - The destination need not provide enough space for the source. If
310-
* necessary, it is reallocated to point to a larger chunk of memory;
307+
* necessary, it is reallocated;
311308
* \post
312309
* - Entries in \ref tempAllocStack from \ref g_startTempAllocStack (on entry
313310
* to the function) are deallocated;
@@ -316,6 +313,7 @@ void freeTempAlloc(void);
316313
* - If the assigned value is the empty string, but the destination not, it is
317314
* freed and assigned to a constant "";
318315
* - \ref db is updated.
316+
* \bug In an out-of-memory situation the program is not exited
319317
*/
320318
void let(vstring *target, const char *source);
321319

0 commit comments

Comments
 (0)