diff options
author | Allen Winter <allen.winter@kdab.com> | 2022-06-11 11:38:24 -0400 |
---|---|---|
committer | Allen Winter <allen.winter@kdab.com> | 2022-06-11 12:59:14 -0400 |
commit | 6b74841772981be4c88dc176634bafd2e6ad7b7c (patch) | |
tree | 751d2668b557e4199dedd1d5881fd58e163b04a0 /examples/access_components.c | |
parent | 3d033a489cba309d98fb52166fbe77908f3305e7 (diff) | |
parent | a8ef3de84cc5740978a49dcf7b8eeb2cd5fc6cb8 (diff) | |
download | libical-git-flexbison.tar.gz |
Merge branch 'master' into flexbisonflexbison
Diffstat (limited to 'examples/access_components.c')
-rw-r--r-- | examples/access_components.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/examples/access_components.c b/examples/access_components.c index c0e3985f..88731fd6 100644 --- a/examples/access_components.c +++ b/examples/access_components.c @@ -1,4 +1,8 @@ -/* Access_component.c */ +/* Access_component.c + + SPDX-FileCopyrightText: <eric@civicknowledge.com> + SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0 +*/ #include <libical/ical.h> @@ -20,13 +24,10 @@ void do_something(icalcomponent *c); constructors, resulting in a compact, neatly formatted way to create components. This style is shown in create_new_component_with_va_args() - - */ icalcomponent* create_new_component() { - /* variable definitions */ icalcomponent* calendar; icalcomponent* event; @@ -57,7 +58,6 @@ icalcomponent* create_new_component() icalproperty_new_version("2.0") ); - /* Here is the short version of the memory rules: If the routine name has "new" in it: @@ -132,7 +132,6 @@ icalcomponent* create_new_component() icalcomponent_add_property(event,property); - /* more properties */ icalcomponent_add_property( @@ -169,7 +168,6 @@ icalcomponent* create_new_component() icalcomponent_add_property(event,property); - property = icalproperty_new_dtend(atime); icalproperty_add_parameter( @@ -189,13 +187,11 @@ icalcomponent* create_new_component() return calendar; } - /* Now, create the same component as in the previous routine, but use the constructor style. */ icalcomponent* create_new_component_with_va_args() { - /* This is a similar set up to the last routine */ icalcomponent* calendar; struct icaltimetype atime = icaltime_from_timet_with_zone(time(0), 0, icaltimezone_get_utc_timezone()); @@ -254,7 +250,6 @@ icalcomponent* create_new_component_with_va_args() 0 ); - /* Note that properties with no parameters can use the regular 'new' constructor, while those with parameters use the 'vanew' constructor. And, be sure that the last argument in the 'vanew' @@ -263,7 +258,6 @@ icalcomponent* create_new_component_with_va_args() return calendar; } - void find_sub_components(icalcomponent* comp) { icalcomponent *c; @@ -286,7 +280,6 @@ void find_sub_components(icalcomponent* comp) do_something(c); } - } /* Ical components only have one internal iterator, so removing the @@ -307,5 +300,4 @@ void remove_vevent_sub_components(icalcomponent* comp){ do_something(c); } - } |