ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/utils.C
(Generate patch)

Comparing deliantra/server/common/utils.C (file contents):
Revision 1.109 by root, Wed Dec 5 19:03:26 2018 UTC vs.
Revision 1.110 by root, Sat Oct 8 21:54:05 2022 UTC

114 114
115 LOG (llevError, "fork abort: %s\n", msg); 115 LOG (llevError, "fork abort: %s\n", msg);
116} 116}
117 117
118void * 118void *
119salloc_ (int n) 119salloc_ (int n) noexcept
120{ 120{
121 void *ptr = g_slice_alloc (n); 121 void *ptr = g_slice_alloc (n);
122 122
123 if (!ptr) 123 if (ecb_expect_false (!ptr))
124 throw std::bad_alloc (); 124 {
125 LOG (llevError, "out of memory allocating %d bytes, aborting.\n", n);
126 abort ();
127 }
125 128
126 slice_alloc += n; 129 slice_alloc += n;
127 return ptr; 130 return ptr;
128} 131}
129 132
133// thos noinline works around a bug in gcc10, which otherwise inlines
134// this fucntion and, only in the inlined versions, optimises out
135// the memset, leasving memory uninitialised.
136ecb_noinline
130void * 137void *
131salloc_ (int n, void *src) 138salloc_ (int n, void *src) noexcept
132{ 139{
133 void *ptr = salloc_ (n); 140 void *ptr = salloc_ (n);
134 141
135 if (src) 142 if (src)
136 memcpy (ptr, src, n); 143 memcpy (ptr, src, n);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines