* Append a string to the list. * * The given string is copied, so it need not survive past the call. */
| 60 | * The given string is copied, so it need not survive past the call. |
| 61 | */ |
| 62 | void |
| 63 | simple_string_list_append(SimpleStringList *list, const char *val) |
| 64 | { |
| 65 | SimpleStringListCell *cell; |
| 66 | |
| 67 | cell = (SimpleStringListCell *) |
| 68 | pg_malloc(offsetof(SimpleStringListCell, val) + strlen(val) + 1); |
| 69 | |
| 70 | cell->next = NULL; |
| 71 | cell->touched = false; |
| 72 | strcpy(cell->val, val); |
| 73 | |
| 74 | if (list->tail) |
| 75 | list->tail->next = cell; |
| 76 | else |
| 77 | list->head = cell; |
| 78 | list->tail = cell; |
| 79 | } |
| 80 | |
| 81 | /* |
| 82 | * Is string present in the list? |
no test coverage detected