[PATCH] Replace errs and mem subroutines to separate files

Dmitry V. Levin ldv at altlinux.org
Mon Jun 26 23:30:12 UTC 2017


On Tue, Jun 27, 2017 at 12:21:52AM +0300, Dmitry V. Levin wrote:
> On Mon, Jun 26, 2017 at 09:05:31PM +0300, Edgar Kaziahmedov wrote:
[...]
> > +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + MUST_BE_ARRAY(a))
> > +
> > +void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
> > +void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
> > +void perror_msg_and_die(const char *fmt, ...)
> > +	ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
> > +void error_msg_and_help(const char *fmt, ...)
> > +	ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
> > +void error_msg_and_die(const char *fmt, ...)
> > +	ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
> > +void die_out_of_memory(void) ATTRIBUTE_NORETURN;
> > +
> > +void *xcalloc(size_t nmemb, size_t size)
> > +	ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1, 2));
> > +void *xmalloc(size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1));
> > +void *xreallocarray(void *ptr, size_t nmemb, size_t size)
> > +	ATTRIBUTE_ALLOC_SIZE((2, 3));
> > +char *xstrdup(const char *str) ATTRIBUTE_MALLOC;
> > +char *xstrndup(const char *str, size_t n) ATTRIBUTE_MALLOC;
> 
> This looks to me like three different groups of declarations.

I was unsure what group die_out_of_memory belongs to,
and why should it be exported in the first place.
After some thought I've decided to unexport it.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170627/e567c2bb/attachment.bin>


More information about the Strace-devel mailing list