|
14 | 14 | *
|
15 | 15 | * The possible states of a `tempfile` object are as follows:
|
16 | 16 | *
|
17 |
| - * - Uninitialized. In this state the object's `on_list` field must be |
18 |
| - * zero but the rest of its contents need not be initialized. As |
19 |
| - * soon as the object is used in any way, it is irrevocably |
20 |
| - * registered in `tempfile_list`, and `on_list` is set. |
| 17 | + * - Inactive/unallocated. The only way to get a tempfile is via a creation |
| 18 | + * function like create_tempfile(). Once allocated, the tempfile is on the |
| 19 | + * global tempfile_list and considered active. |
21 | 20 | *
|
22 | 21 | * - Active, file open (after `create_tempfile()` or
|
23 | 22 | * `reopen_tempfile()`). In this state:
|
24 | 23 | *
|
25 | 24 | * - the temporary file exists
|
26 |
| - * - `active` is set |
27 | 25 | * - `filename` holds the filename of the temporary file
|
28 | 26 | * - `fd` holds a file descriptor open for writing to it
|
29 | 27 | * - `fp` holds a pointer to an open `FILE` object if and only if
|
|
35 | 33 | * `fd` is -1, and `fp` is `NULL`.
|
36 | 34 | *
|
37 | 35 | * - Inactive (after `delete_tempfile()`, `rename_tempfile()`, or a
|
38 |
| - * failed attempt to create a temporary file). In this state: |
39 |
| - * |
40 |
| - * - `active` is unset |
41 |
| - * - `filename` is empty (usually, though there are transitory |
42 |
| - * states in which this condition doesn't hold). Client code should |
43 |
| - * *not* rely on the filename being empty in this state. |
44 |
| - * - `fd` is -1 and `fp` is `NULL` |
45 |
| - * - the object is removed from `tempfile_list` (but could be used again) |
| 36 | + * failed attempt to create a temporary file). The struct is removed from |
| 37 | + * the global tempfile_list and deallocated. |
46 | 38 | *
|
47 | 39 | * A temporary file is owned by the process that created it. The
|
48 | 40 | * `tempfile` has an `owner` field that records the owner's PID. This
|
|
0 commit comments