Bug 1850505 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

mozHunspellFileMgrHost::GetLine is defined as followed:

```c++
 bool mozHunspellFileMgrHost::GetLine(std::string& aResult) {
  nsAutoCString line;
  auto res = ReadLine(line);
  if (res.isErr()) {
    return false;
  }

  aResult.assign(line.BeginReading(), line.Length());
  return true;
}
```

`nsAutoCString`  iteracts poorly with `-ftrivial-auto-var-init ` as it always initializes the internal buffer. In that particular case `line` is used a temporary container, we could avoid bothe the initialization and the copy by directly writing to a `std::string`
mozHunspellFileMgrHost::GetLine is defined as followed:

```c++
 bool mozHunspellFileMgrHost::GetLine(std::string& aResult) {
  nsAutoCString line;
  auto res = ReadLine(line);
  if (res.isErr()) {
    return false;
  }

  aResult.assign(line.BeginReading(), line.Length());
  return true;
}
```

`nsAutoCString`  iteracts poorly with `-ftrivial-auto-var-init ` as it always initializes the internal buffer. In that particular case `line` is used a temporary container, we could avoid both the initialization and the copy by directly writing to a `std::string`

Back to Bug 1850505 Comment 0