icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:VCALENDAR\n");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:VCALENDAR"); icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
icalproperty* icalproperty_new_from_string(const char* str){    size_t buf_size = 1024;    char* buf = icalmemory_new_buffer(buf_size);    char* buf_ptr = buf;      icalproperty *prop;    icalcomponent *comp;    int errors  = 0;#ifdef ICAL_UNIX_NEWLINE    char newline[] = "\n";#else    char newline[] = "\r\n";#endif    icalerror_check_arg_rz( (str!=0),"str");    /* Is this a HACK or a crafty reuse of code? */    icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:VCALENDAR\n");    icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);    icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);        icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:VCALENDAR\n");    comp = icalparser_parse_string(buf);    if(comp == 0){        icalerror_set_errno(ICAL_PARSE_ERROR);        return 0;    }    errors = icalcomponent_count_errors(comp);    prop = icalcomponent_get_first_property(comp,ICAL_ANY_PROPERTY);    icalcomponent_remove_property(comp,prop);    icalcomponent_free(comp);    free(buf);    if(errors > 0){        icalproperty_free(prop);        return 0;    } else {        return prop;    }    }