From f79eb3b08ccdd47254d7749cf063c6512bffd69b Mon Sep 17 00:00:00 2001 From: Ken Murchison Date: Tue, 7 May 2024 14:46:55 -0400 Subject: [PATCH] Add __attribute__((sentinel)) to all vcard_*_vanew function declarations --- src/libicalvcard/vcardcomponent.h | 3 ++- src/libicalvcard/vcardderivedproperty.h.in | 1 + src/libicalvcard/vcardvalue.c | 8 ++++---- src/test/libicalvcard/vcard_test.c | 16 ++++++++-------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/libicalvcard/vcardcomponent.h b/src/libicalvcard/vcardcomponent.h index 46256e6d6..3dcc42d97 100644 --- a/src/libicalvcard/vcardcomponent.h +++ b/src/libicalvcard/vcardcomponent.h @@ -12,6 +12,7 @@ #ifndef VCARDCOMPONENT_H #define VCARDCOMPONENT_H +#include "libical_sentinel.h" #include "libical_vcard_export.h" #include "vcardproperty.h" #include "pvl.h" @@ -45,7 +46,7 @@ LIBICAL_VCARD_EXPORT vcardcomponent *vcardcomponent_new_from_string(const char * /** @brief Constructor */ -LIBICAL_VCARD_EXPORT vcardcomponent *vcardcomponent_vanew(vcardcomponent_kind kind, ...); +LIBICAL_VCARD_EXPORT LIBICAL_SENTINEL vcardcomponent *vcardcomponent_vanew(vcardcomponent_kind kind, ...); /*** @brief Destructor */ diff --git a/src/libicalvcard/vcardderivedproperty.h.in b/src/libicalvcard/vcardderivedproperty.h.in index 9b7e128ec..4493c7ad5 100644 --- a/src/libicalvcard/vcardderivedproperty.h.in +++ b/src/libicalvcard/vcardderivedproperty.h.in @@ -12,6 +12,7 @@ #ifndef VCARDDERIVEDPROPERTY_H #define VCARDDERIVEDPROPERTY_H +#include "libical_sentinel.h" #include "vcardderivedvalue.h" #include "vcardparameter.h" diff --git a/src/libicalvcard/vcardvalue.c b/src/libicalvcard/vcardvalue.c index 3791b85ea..4dbcf0b61 100644 --- a/src/libicalvcard/vcardvalue.c +++ b/src/libicalvcard/vcardvalue.c @@ -313,7 +313,7 @@ static vcardvalue *vcardvalue_new_from_string_with_error(vcardvalue_kind kind, "Could not parse %s as a %s property", str, vcardvalue_kind_to_string(kind)); errParam = vcardparameter_new_xlicerrortype(VCARD_XLICERRORTYPE_VALUEPARSEERROR); - *error = vcardproperty_vanew_xlicerror(temp, errParam, 0); + *error = vcardproperty_vanew_xlicerror(temp, errParam, (void *) 0); vcardparameter_free(errParam); } break; @@ -377,7 +377,7 @@ static vcardvalue *vcardvalue_new_from_string_with_error(vcardvalue_kind kind, "Could not parse %s as a %s property", str, vcardvalue_kind_to_string(kind)); errParam = vcardparameter_new_xlicerrortype(VCARD_XLICERRORTYPE_VALUEPARSEERROR); - *error = vcardproperty_vanew_xlicerror(temp, errParam, 0); + *error = vcardproperty_vanew_xlicerror(temp, errParam, (void *) 0); vcardparameter_free(errParam); } break; @@ -478,7 +478,7 @@ static vcardvalue *vcardvalue_new_from_string_with_error(vcardvalue_kind kind, snprintf(temp, TMP_BUF_SIZE, "Unknown type for \'%s\'", str); errParam = vcardparameter_new_xlicerrortype(VCARD_XLICERRORTYPE_VALUEPARSEERROR); - *error = vcardproperty_vanew_xlicerror(temp, errParam, 0); + *error = vcardproperty_vanew_xlicerror(temp, errParam, (void *) 0); vcardparameter_free(errParam); } @@ -497,7 +497,7 @@ static vcardvalue *vcardvalue_new_from_string_with_error(vcardvalue_kind kind, snprintf(temp, TMP_BUF_SIZE, "Failed to parse value: \'%s\'", str); errParam = vcardparameter_new_xlicerrortype(VCARD_XLICERRORTYPE_VALUEPARSEERROR); - *error = vcardproperty_vanew_xlicerror(temp, errParam, 0); + *error = vcardproperty_vanew_xlicerror(temp, errParam, (void *) 0); vcardparameter_free(errParam); } diff --git a/src/test/libicalvcard/vcard_test.c b/src/test/libicalvcard/vcard_test.c index 5b9a9a0e9..f245f5803 100644 --- a/src/test/libicalvcard/vcard_test.c +++ b/src/test/libicalvcard/vcard_test.c @@ -146,7 +146,7 @@ static vcardcomponent *test_comp_vanew(void) card = vcardcomponent_vanew(VCARD_VCARD_COMPONENT, vcardproperty_new_version(VCARD_VERSION_40), vcardproperty_new_kind(VCARD_KIND_INDIVIDUAL), - 0); + (void *) 0); if (card == NULL) { fprintf(stderr, "Failed to create vCard\n"); @@ -194,7 +194,7 @@ static void test_add_props(vcardcomponent *card) vcardproperty_vanew_note("Test vCard", vcardparameter_new_language("en"), vcardparameter_new_pid(sa), - 0); + (void *) 0); vcardcomponent_add_property(card, prop); vcardproperty_set_group(prop, "group1"); @@ -276,30 +276,30 @@ static void test_add_props(vcardcomponent *card) /* Create and add LOGO property */ prop = vcardproperty_vanew_logo("https://example.com/logo.png", vcardparameter_new_mediatype("image/png"), - 0); + (void *) 0); vcardcomponent_add_property(card, prop); /* Create and add UID property */ prop = vcardproperty_vanew_uid("foo-bar", vcardparameter_new_value(VCARD_VALUE_TEXT), - 0); + (void *) 0); vcardcomponent_add_property(card, prop); /* Create and add TEL property */ prop = vcardproperty_vanew_tel("tel:+1-888-555-1212", vcardparameter_new_value(VCARD_VALUE_URI), - 0); + (void *) 0); vcardcomponent_add_property(card, prop); /* Create and add LANG properties */ prop = vcardproperty_vanew_lang("fr", vcardparameter_new_pref(2), - 0); + (void *) 0); vcardcomponent_add_property(card, prop); prop = vcardproperty_vanew_lang("en", - vcardparameter_new_pref(1), - 0); + vcardparameter_new_pref(1), + (void *) 0); vcardcomponent_add_property(card, prop); vcardrestriction_check(card);