summaryrefslogtreecommitdiff
path: root/src/libical/icalproperty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libical/icalproperty.c')
-rw-r--r--src/libical/icalproperty.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/src/libical/icalproperty.c b/src/libical/icalproperty.c
index 15dc7320..66e2fd2a 100644
--- a/src/libical/icalproperty.c
+++ b/src/libical/icalproperty.c
@@ -2,18 +2,9 @@
FILE: icalproperty.c
CREATOR: eric 28 April 1999
- (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
+ SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
- This library is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
-
- Or:
-
- The Mozilla Public License Version 2.0. You may obtain a copy of
- the License at https://www.mozilla.org/MPL/
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
The original code is icalproperty.c
======================================================================*/
@@ -67,7 +58,7 @@ icalproperty *icalproperty_new_impl(icalproperty_kind kind)
if (!icalproperty_kind_is_valid(kind))
return NULL;
- if ((prop = (icalproperty *) malloc(sizeof(icalproperty))) == 0) {
+ if ((prop = (icalproperty *) icalmemory_new_buffer(sizeof(icalproperty))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -91,7 +82,7 @@ icalproperty *icalproperty_new(icalproperty_kind kind)
return (icalproperty *) icalproperty_new_impl(kind);
}
-icalproperty *icalproperty_new_clone(icalproperty *old)
+icalproperty *icalproperty_clone(const icalproperty *old)
{
icalproperty *new;
pvl_elem p;
@@ -101,7 +92,7 @@ icalproperty *icalproperty_new_clone(icalproperty *old)
icalerror_check_arg_rz((new != 0), "new");
if (old->value != 0) {
- new->value = icalvalue_new_clone(old->value);
+ new->value = icalvalue_clone(old->value);
}
if (old->x_name != 0) {
@@ -116,7 +107,7 @@ icalproperty *icalproperty_new_clone(icalproperty *old)
}
for (p = pvl_head(old->parameters); p != 0; p = pvl_next(p)) {
- icalparameter *param = icalparameter_new_clone(pvl_data(p));
+ icalparameter *param = icalparameter_clone(pvl_data(p));
if (param == 0) {
icalproperty_free(new);
@@ -130,6 +121,11 @@ icalproperty *icalproperty_new_clone(icalproperty *old)
return new;
}
+icalproperty *icalproperty_new_clone(icalproperty *old)
+{
+ return icalproperty_clone(old);
+}
+
icalproperty *icalproperty_new_from_string(const char *str)
{
size_t buf_size = 1024;
@@ -155,7 +151,7 @@ icalproperty *icalproperty_new_from_string(const char *str)
if (comp == 0) {
icalerror_set_errno(ICAL_PARSE_ERROR);
- free(buf);
+ icalmemory_free_buffer(buf);
return 0;
}
@@ -166,7 +162,7 @@ icalproperty *icalproperty_new_from_string(const char *str)
icalcomponent_remove_property(comp, prop);
icalcomponent_free(comp);
- free(buf);
+ icalmemory_free_buffer(buf);
if (errors > 0) {
icalproperty_free(prop);
@@ -198,7 +194,7 @@ void icalproperty_free(icalproperty *p)
pvl_free(p->parameters);
if (p->x_name != 0) {
- free(p->x_name);
+ icalmemory_free_buffer(p->x_name);
}
p->kind = ICAL_NO_PROPERTY;
@@ -208,7 +204,7 @@ void icalproperty_free(icalproperty *p)
p->x_name = 0;
p->id[0] = 'X';
- free(p);
+ icalmemory_free_buffer(p);
}
/* This returns where the start of the next line should be. chars_left does
@@ -417,13 +413,13 @@ char *icalproperty_as_ical_string_r(icalproperty *prop)
}
if (kind == ICAL_VALUE_PARAMETER) {
- free((char *)kind_string);
+ icalmemory_free_buffer((char *)kind_string);
continue;
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
- free((char *)kind_string);
+ icalmemory_free_buffer((char *)kind_string);
}
/* Append value */
@@ -442,7 +438,7 @@ char *icalproperty_as_ical_string_r(icalproperty *prop)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "ERROR: No Value");
#endif
}
- free(str);
+ icalmemory_free_buffer(str);
} else {
#if ICAL_ALLOW_EMPTY_PROPERTIES == 0
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "ERROR: No Value");
@@ -595,13 +591,13 @@ char *icalproperty_get_parameter_as_string_r(icalproperty *prop, const char *nam
if (t == 0) {
icalerror_set_errno(ICAL_INTERNAL_ERROR);
- free(str);
+ icalmemory_free_buffer(str);
return 0;
}
/* Strip the property name and the equal sign */
pv = icalmemory_strdup(t + 1);
- free(str);
+ icalmemory_free_buffer(str);
/* Is the string quoted? */
pvql = strchr(pv, '"');
@@ -611,13 +607,13 @@ char *icalproperty_get_parameter_as_string_r(icalproperty *prop, const char *nam
/* Strip everything up to the first quote */
str = icalmemory_strdup(pvql + 1);
- free(pv);
+ icalmemory_free_buffer(pv);
/* Search for the end quote */
pvqr = strrchr(str, '"');
if (pvqr == 0) {
icalerror_set_errno(ICAL_INTERNAL_ERROR);
- free(str);
+ icalmemory_free_buffer(str);
return 0;
}
@@ -807,7 +803,7 @@ void icalproperty_set_value_from_string(icalproperty *prop, const char *str, con
if (nval == 0) {
/* icalvalue_new_from_string sets errno */
- assert(icalerrno != ICAL_NO_ERROR);
+ icalassert(icalerrno != ICAL_NO_ERROR);
return;
}
@@ -847,7 +843,7 @@ void icalproperty_set_x_name(icalproperty *prop, const char *name)
icalerror_check_arg_rv((prop != 0), "prop");
if (prop->x_name != 0) {
- free(prop->x_name);
+ icalmemory_free_buffer(prop->x_name);
}
prop->x_name = icalmemory_strdup(name);