Add new files from gnulib: sh-quote and system-quote.
[libquote.git] / quoting-slots.h
blob62a023884db6a90f373e707e37218eb2de3fab56
1 /* quoting-slots.h - struct quoting_slots declaration for quote.h and quotearg.h.
3 Copyright (C) 2022 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 /* Written by Sergey Sushilin <sergeysushilin@protonmail.com> */
20 #ifndef LIBQUOTE_QUOTING_SLOTS_H
21 #define LIBQUOTE_QUOTING_SLOTS_H 1
23 #if !defined (LIBQUOTE_QUOTE_H) && !defined (LIBQUOTE_QUOTEARG_H)
24 # error do not include this header directly, include quote.h or quotearg.h instead.
25 #endif
27 /* A storage slot with size and pointer to a buffer. */
28 struct quoting_slot_vector
30 size_t size;
31 char *buffer;
34 struct quoting_slots
36 /* Preallocate a slot 0 buffer, so that the caller can always quote
37 one small component of a "memory exhausted" message in slot 0. */
38 char slot0[256];
39 struct quoting_slot_vector slot_vector0;
40 unsigned int n_slots;
41 struct quoting_slot_vector *slot_vector;
44 /* Initialize quoting slots for further using. */
45 extern void quoting_slots_initialize (struct quoting_slots *q);
47 /* Free any dynamically allocated memory. */
48 extern void quoting_slots_finalize (struct quoting_slots *q);
50 #endif /* LIBQUOTE_QUOTING_SLOTS_H */