This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4] sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable


On 11/6/19 10:01 AM, Alistair Francis wrote:
+  ts32 = valid_timespec64_to_timespec (*req);
The man pages for clock_nanosleep (e.g. [2], [3]) do not mention about
the possibility to have *req equal to NULL, hence I do assume that we
don't need to do it here as well...
I really don't like accessing a pointer without first checking it.
__clock_nanosleep is going to be called from inside glibc so I think
it makes sense to keep the check in.

Sorry, I'm not understanding this part of the discussion. req is a pointer to a structure, so I assumed that "*req equal to NULL" was intended to read "req equal to NULL" and Lukasz was commenting that he was assuming that the code was correct as-is and does not need a "req != NULL" test. But your reply makes it sound like there's already such a test, which is not something that I see in the proposed patch.

As I understand it, the glibc tradition generally is as Lukasz suggested, in that if there's no requirement to check for null pointers we generally don't add one. (Of course there are exceptions for historical reasons etc.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]