crm_malloc(buffer, sizeof(char) * (length+1));
crm_malloc0(buffer, sizeof(char) * (length+1));
file2xml(FILE *input){	#ifdef USE_LIBXML	char ch = 0;	gboolean more = TRUE;	gboolean inTag = FALSE;	crm_data_t *xml_object = NULL;	xmlBufferPtr xml_buffer = xmlBufferCreate();	const char *the_xml;	xmlDocPtr doc;	if(input == NULL) {		crm_err("File pointer was NULL");		return NULL;	}		while (more) {		ch = fgetc(input);/* 		crm_devel("Got [%c]", ch); */		switch(ch) {			case EOF: 			case 0:				ch = 0;				more = FALSE; 				xmlBufferAdd(xml_buffer, &ch, 1);				break;			case '>':			case '<':				inTag = TRUE;				if(ch == '>') inTag = FALSE;				xmlBufferAdd(xml_buffer, &ch, 1);				break;			case '\n':			case '\t':			case ' ':				ch = ' ';				if(inTag) {					xmlBufferAdd(xml_buffer, &ch, 1);				} 				break;			default:				xmlBufferAdd(xml_buffer, &ch, 1);				break;		}	}	xmlInitParser();	the_xml = xmlBufferContent(xml_buffer);	doc = xmlParseMemory(the_xml, strlen(the_xml));	xmlCleanupParser();		if (doc == NULL) {		crm_err("Malformed XML [xml=%s]", the_xml);		xmlBufferFree(xml_buffer);		return NULL;	}	xmlBufferFree(xml_buffer);	xml_object = xmlDocGetRootElement(doc);	crm_xml_devel(xml_object, "Created fragment");	return xml_object;#else	char *buffer = NULL;	crm_data_t *new_obj = NULL;	int start = 0, length = 0, read_len = 0;		/* see how big the file is */	start  = ftell(input);	fseek(input, 0L, SEEK_END);	length = ftell(input);	fseek(input, 0L, start);		if(start != ftell(input)) {		crm_err("fseek not behaving");		return NULL;	}	crm_devel("Reading %d bytes from file", length);	crm_malloc(buffer, sizeof(char) * (length+1));	read_len = fread(buffer, sizeof(char), length, input);	if(read_len != length) {		crm_err("Calculated and read bytes differ: %d vs. %d",			length, read_len);	} else  if(length > 0) {		new_obj = string2xml(buffer);	} else {		crm_warn("File contained no XML");	}		crm_free(buffer);	return new_obj;#endif	}