add: if (w) sprintf(version, "%d", w->document_index++); else strcpy(version, "0");
context: int start_winfo_doc(str* _b, int _l){	str strs[10];	int n_strs = 0;	int i;	int len = 0;	if ((XML_VERSION_L + 	     CRLF_L	    ) > _l) {		paerrno = PA_SMALL_BUFFER;		LOG(L_ERR, "start_pidf_doc(): Buffer too small\n");		return -1;	}	add_string(XML_VERSION, XML_VERSION_L);	add_string(CRLF, CRLF_L);	add_string(WATCHERINFO_STAG, WATCHERINFO_STAG_L);	add_string(CRLF, CRLF_L);	if (_l < len) {		paerrno = PA_SMALL_BUFFER;		LOG(L_ERR, "winfo_add_resource(): Buffer too small\n");		return -1;	}	for (i = 0; i < n_strs; i++)		str_append(_b, strs[i].s, strs[i].len);	return 0;}