/src/libical/src/libicalvcard/vcardtextlist.c
Line | Count | Source |
1 | | /*====================================================================== |
2 | | FILE: vcardtextlist.c |
3 | | CREATOR: Robert Stepanek 1 Feb 2026 |
4 | | |
5 | | SPDX-FileCopyrightText: 2026, Fastmail Pty. Ltd. (https://fastmail.com) |
6 | | SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0 |
7 | | ======================================================================*/ |
8 | | |
9 | | /** |
10 | | * @file vcardtextlist.c |
11 | | * @brief Implements functions for creating vCard text lists |
12 | | */ |
13 | | |
14 | | #ifdef HAVE_CONFIG_H |
15 | | #include <config.h> |
16 | | #endif |
17 | | |
18 | | #include "vcardtextlist.h" |
19 | | #include "vcardvalue.h" |
20 | | #include "icalerror_p.h" |
21 | | #include "icalmemory.h" |
22 | | |
23 | | vcardstrarray *vcardtextlist_new_from_string(const char *str, char sep) |
24 | 36 | { |
25 | 36 | icalerror_check_arg_rz(str != 0, "str"); |
26 | 36 | icalerror_check_arg_rz(sep != 0, "sep"); |
27 | | |
28 | 36 | vcardstrarray *array = vcardstrarray_new(2); |
29 | 36 | const char sep_str[2] = {sep, 0}; |
30 | | |
31 | 1.04k | do { |
32 | 1.04k | char *dequoted_str = vcardvalue_strdup_and_dequote_text(&str, sep_str); |
33 | 1.04k | vcardstrarray_append(array, dequoted_str); |
34 | 1.04k | icalmemory_free_buffer(dequoted_str); |
35 | 1.04k | } while (*str++ != '\0'); |
36 | | |
37 | 36 | return array; |
38 | 36 | } |