diff options
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 726d5cce..597e5e7d 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(void) { - /* variable definitions */ icalcomponent* calendar; icalcomponent* event; @@ -57,7 +58,6 @@ icalcomponent* create_new_component(void) 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(void) icalcomponent_add_property(event,property); - /* more properties */ icalcomponent_add_property( @@ -169,7 +168,6 @@ icalcomponent* create_new_component(void) icalcomponent_add_property(event,property); - property = icalproperty_new_dtend(atime); icalproperty_add_parameter( @@ -189,13 +187,11 @@ icalcomponent* create_new_component(void) return calendar; } - /* Now, create the same component as in the previous routine, but use the constructor style. */ icalcomponent* create_new_component_with_va_args(void) { - /* 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(void) 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(void) 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); } - } |