mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1233234 - part 3 - clean up UniquePtr usage in WritePrefFile; r=njn
We shouldn't use .get() on UniquePtr<T[]> unless we have to, and it makes the code clearer to not use pointer incrementing in any event.
This commit is contained in:
parent
23a987ee55
commit
0e8de7a4cc
@ -948,12 +948,13 @@ Preferences::WritePrefFile(nsIFile* aFile)
|
||||
// write out the file header
|
||||
outStream->Write(outHeader, sizeof(outHeader) - 1, &writeAmount);
|
||||
|
||||
char** walker = valueArray.get();
|
||||
for (uint32_t valueIdx = 0; valueIdx < gHashTable->EntryCount(); valueIdx++, walker++) {
|
||||
if (*walker) {
|
||||
outStream->Write(*walker, strlen(*walker), &writeAmount);
|
||||
for (uint32_t valueIdx = 0; valueIdx < gHashTable->EntryCount(); valueIdx++) {
|
||||
char*& pref = valueArray[valueIdx];
|
||||
if (pref) {
|
||||
outStream->Write(pref, strlen(pref), &writeAmount);
|
||||
outStream->Write(NS_LINEBREAK, NS_LINEBREAK_LEN, &writeAmount);
|
||||
free(*walker);
|
||||
free(pref);
|
||||
pref = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user