Skip to content

Commit

Permalink
Add __attribute__((sentinel)) to all vcard_*_vanew function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed May 7, 2024
1 parent 0c4a9f5 commit f79eb3b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/libicalvcard/vcardcomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
*/
Expand Down
1 change: 1 addition & 0 deletions src/libicalvcard/vcardderivedproperty.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef VCARDDERIVEDPROPERTY_H
#define VCARDDERIVEDPROPERTY_H

#include "libical_sentinel.h"
#include "vcardderivedvalue.h"
#include "vcardparameter.h"

Expand Down
8 changes: 4 additions & 4 deletions src/libicalvcard/vcardvalue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
16 changes: 8 additions & 8 deletions src/test/libicalvcard/vcard_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f79eb3b

Please sign in to comment.