Re: [4/6] wsdapi: Implement "Hello" message creation support.
- obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); + heap = GetProcessHeap(); + obj = HeapAlloc(heap, HEAP_ZERO_MEMORY, sizeof(*obj)); I really hope we don't have to start optimizing for fewer GetProcessHeap calls. + /* Calculate space needed, including colon and potential trailing space */ + memoryNeeded = sizeof(WCHAR) * (lstrlenW(cur->Element->LocalName) + lstrlenW(cur->Element->Space->PreferredPrefix) + 2); This doesn't account for the terminating NULL wsprintfW will add. + discoveredNamespaces = WSDAllocateLinkedMemory(NULL, sizeof(struct list)); + if (!discoveredNamespaces) goto cleanup; Why not allocate this on the stack?
On 27/07/2017 22:11, Vincent Povirk wrote:
I really hope we don't have to start optimizing for fewer GetProcessHeap calls.
I'll amend. :)
This doesn't account for the terminating NULL wsprintfW will add.
Thanks for catching that.
+ discoveredNamespaces = WSDAllocateLinkedMemory(NULL, sizeof(struct list)); + if (!discoveredNamespaces) goto cleanup;
Why not allocate this on the stack?
The discovered namespaces (and their child strings) are linked to the parent namespace (and ultimately the discoveredNamespaces list), simplifying cleanup. Cheers, -- Owen Rudge http://www.owenrudge.net/
participants (2)
-
Owen Rudge -
Vincent Povirk