We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 459bd8d + 1535024 commit 8bf3a36Copy full SHA for 8bf3a36
glib/src/gstring.rs
@@ -2317,12 +2317,10 @@ impl IntoGStr for &str {
2317
2318
impl IntoGStr for String {
2319
#[inline]
2320
- fn run_with_gstr<T, F: FnOnce(&GStr) -> T>(self, f: F) -> T {
2321
- if self.len() < MAX_STACK_ALLOCATION {
2322
- self.as_str().run_with_gstr(f)
2323
- } else {
2324
- f(GString::from(self).as_gstr())
2325
- }
+ fn run_with_gstr<T, F: FnOnce(&GStr) -> T>(mut self, f: F) -> T {
+ self.push('\0');
+ let gs = unsafe { GStr::from_utf8_with_nul_unchecked(self.as_bytes()) };
+ f(gs)
2326
}
2327
2328
0 commit comments