*/
icalcomponent_as_ical_string (icalcomponent* component){   char* buf, *out_buf;   const char* tmp_buf;   size_t buf_size = 1024;   char* buf_ptr = 0;    pvl_elem itr;    struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;/* WIN32 automatically adds the \r, Anybody else need it?#ifdef ICAL_UNIX_NEWLINE    */    char newline[] = "\n";/*#else    char newline[] = "\r\n";#endif*/      icalcomponent *c;   icalproperty *p;   icalcomponent_kind kind = icalcomponent_isa(component);   const char* kind_string;   buf = icalmemory_new_buffer(buf_size);   buf_ptr = buf;    icalerror_check_arg_rz( (component!=0), "component");   icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT");      kind_string  = icalcomponent_kind_to_string(kind);   icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component");   icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:");   icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);   icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);      for( itr = pvl_head(impl->properties);	 itr != 0;	 itr = pvl_next(itr))    {		p = (icalproperty*)pvl_data(itr);		icalerror_assert((p!=0),"Got a null property");	tmp_buf = icalproperty_as_ical_string(p);		icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);    }         for( itr = pvl_head(impl->components);	itr != 0;	itr = pvl_next(itr))   {	       c = (icalcomponent*)pvl_data(itr);              tmp_buf = icalcomponent_as_ical_string(c);              icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);          }      icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:");   icalmemory_append_string(&buf, &buf_ptr, &buf_size, 			    icalcomponent_kind_to_string(kind));   icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);   out_buf = icalmemory_tmp_copy(buf);   free(buf);   return out_buf;}