Skip to content

Commit b07d6a5

Browse files
authored
Merge pull request libical#718 from libical/vcardcomponent_get_version
2 parents eba5ed5 + b47da89 commit b07d6a5

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/libicalvcard/vcardcomponent.c

+7-12
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
struct vcardcomponent_impl {
3030
char id[5];
3131
vcardcomponent_kind kind;
32-
vcardproperty_version version;
32+
vcardproperty *versionp;
3333
char *x_name;
3434
pvl_list properties;
3535
pvl_elem property_iterator;
@@ -67,7 +67,6 @@ static vcardcomponent *vcardcomponent_new_impl(vcardcomponent_kind kind)
6767
strcpy(comp->id, "comp");
6868

6969
comp->kind = kind;
70-
comp->version = VCARD_VERSION_NONE;
7170
comp->properties = pvl_newlist();
7271
comp->components = pvl_newlist();
7372

@@ -287,7 +286,7 @@ void vcardcomponent_add_property(vcardcomponent *comp, vcardproperty *property)
287286
pvl_push(comp->properties, property);
288287

289288
if (vcardproperty_isa(property) == VCARD_VERSION_PROPERTY) {
290-
comp->version = vcardproperty_get_version(property);
289+
comp->versionp = property;
291290
}
292291
}
293292

@@ -308,7 +307,7 @@ void vcardcomponent_remove_property(vcardcomponent *comp, vcardproperty *propert
308307
#endif
309308

310309
if (vcardproperty_isa(property) == VCARD_VERSION_PROPERTY) {
311-
comp->version = VCARD_VERSION_NONE;
310+
comp->versionp = 0;
312311
}
313312

314313
for (itr = pvl_head(comp->properties); itr != 0; itr = next_itr) {
@@ -1223,8 +1222,6 @@ void vcardcomponent_transform(vcardcomponent *impl,
12231222
} else {
12241223
comp_to_v3(impl);
12251224
}
1226-
1227-
impl->version = version;
12281225
}
12291226

12301227
for (itr = pvl_head(impl->components); itr != 0; itr = pvl_next(itr)) {
@@ -1240,18 +1237,16 @@ enum vcardproperty_version vcardcomponent_get_version(vcardcomponent *card)
12401237
{
12411238
icalerror_check_arg_rz(card != 0, "card");
12421239

1243-
if (card->version == VCARD_VERSION_NONE) {
1244-
vcardproperty *prop =
1240+
if (card->versionp == 0) {
1241+
card->versionp =
12451242
vcardcomponent_get_first_property(card, VCARD_VERSION_PROPERTY);
12461243

1247-
if (prop == 0) {
1244+
if (card->versionp == 0) {
12481245
return VCARD_VERSION_NONE;
12491246
}
1250-
1251-
card->version = vcardproperty_get_version(prop);
12521247
}
12531248

1254-
return card->version;
1249+
return vcardproperty_get_version(card->versionp);
12551250
}
12561251

12571252
const char *vcardcomponent_get_uid(vcardcomponent *card)

0 commit comments

Comments
 (0)