NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/49487: Import reallocarray(3) from OpenBSD



The following reply was made to PR bin/49487; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
	n54%gmx.com@localhost
Cc: 
Subject: Re: bin/49487: Import reallocarray(3) from OpenBSD
Date: Fri, 26 Dec 2014 21:10:35 -0500

 On Dec 27,  2:05am, n54%gmx.com@localhost ("Kamil Rytarowski") wrote:
 -- Subject: Re: bin/49487: Import reallocarray(3) from OpenBSD
 
 |  maybe go for:
 |  int mul_overflow(intmax_t a, intmax_t b, intmax_t max, intmax_t *c);
 |  int umul_overflow(uintmax_t a, uintmax_t b, uintmax_t max, uintmax_t *c);
 |  
 |  Then we will not use __builtins from edge versions of GCC... but this building block will look cleaner and reusable, including in the implementation of calloc(3). Optimizing these overflow checks (with intrinsic compiler functions) isn't a big win, as the majority of time is anyway in the kernel with pages allocation.
 |  
 |  What do you think?
 
 This discussion probably belongs in tech-userlevel. I think we need the
 size_t flavor of those functions. The advantage of the __builtin flavors
 is that they can be polymorphic, a feature that can only be done in c
 using unportable macro extensions or _Generic which is a c-11 feature...
 
 christos
 


Home | Main Index | Thread Index | Old Index