Nikolay Sivov bunglehead@gmail.com writes:
On 8/2/2013 13:33, Alexandre Julliard wrote:
Nikolay Sivov nsivov@codeweavers.com writes:
@@ -1031,6 +1105,17 @@ static BOOL parse_window_class_elem(xmlbuf_t* xmlbuf, struct dll_redirect* dll) if (!(entity->u.class.name = xmlstrdupW(&content))) return FALSE;
- /* each class entry needs index, data and string data */
- acl->actctx->wndclass_section_len += sizeof(struct wndclass_index);
- acl->actctx->wndclass_section_len += sizeof(struct wndclass_redirect_data);
- /* original name is stored separately */
- acl->actctx->wndclass_section_len += aligned_string_len((content.len+1)*sizeof(WCHAR));
- /* versioned name and module name are stored one after another */
- len = get_assembly_version(assembly, NULL) + content.len + 2 /* null terminator and '!' separator */;
- len += strlenW(dll->name) + 1;
- acl->actctx->wndclass_section_len += aligned_string_len(len*sizeof(WCHAR));
- acl->actctx->wndclass_count++;
It would be better to do this at the time you build the structure. The parser shouldn't need to worry about this.
Sure, I can do it this way. The idea was to alloc everything in one step. Would it be okay to realloc for each entry then at a time I'm about to add one?
Not for each entry, you'd need to double the size each time. But computing it beforehand should be pretty easy.