[PATCH] Replace errs and mem subroutines to separate files

Dmitry V. Levin ldv at altlinux.org
Tue Jun 27 00:39:51 UTC 2017


On Tue, Jun 27, 2017 at 03:32:38AM +0300, Edgar Kaziahmedov wrote:
> On Tue, 27 Jun 2017 02:30:12 +0300, Dmitry V. Levin wrote:
> > 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.
> 
> It isn't clear what do you mean, you imply that it's quite obviously
> what group die_out_of_memory has to belong to? error_prints or xmalloc
> group? 

Starting with commit v4.17-122-g2698d1d die_out_of_memory
is a static function defined in xmalloc.c file.


-- 
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/ff66a93f/attachment.bin>


More information about the Strace-devel mailing list