You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2001/08/03 01:38:04 UTC
[PATCH] revised: Does anyone want this committed?
First off - this patch names apr_pool_t allocations (nothing to do with pipes,
sorry for my earlier misnomer.)
From: "Branko Čibej" <br...@xbc.nu>
Sent: Thursday, August 02, 2001 5:51 PM
> William A. Rowe, Jr. wrote:
>
> >2. I can't figure out how to stringize __LINE__, which sort of sucks.
> >
> The Well Known Hack is
>
> #define STRINGIFY(S) REALLY_STRINGIFY(S)
> #define REALLY_STRINGIFY(S) #S
>
> char this_line_number[] = STRINGIFY(__LINE__);
Thanks, the revised patch is attached :)
One other bit of coolness for win32 developers that I like...
--- srclib/apr/include/arch/win32/apr_private.h 2001/06/06 00:07:46 1.24
+++ srclib/apr/include/arch/win32/apr_private.h 2001/08/02 23:13:00
@@ -191,5 +191,8 @@
ptr = (type *)apr_sms_calloc(struct->mem_sys, sizeof(type)); \
}
+#define abort() DebugBreak();
+#define assert(x) if (!(x)) DebugBreak;
+
#endif /*APR_PRIVATE_H*/
#endif /*WIN32*/
This works nicely around WIN32's bogus crtlib interceptions of abort(), which
make backtracing somewhat difficult (espessially with the BoundsChecker intercepts.)
Re: [PATCH] revised: Does anyone want this committed?
Posted by Branko Čibej <br...@xbc.nu>.
Did you actually compile any of this?
>
>+#define abort() DebugBreak();
>+#define assert(x) if (!(x)) DebugBreak;
>+
> #endif /*APR_PRIVATE_H*/
> #endif /*WIN32*/
>
Should be:
#define abort() DebugBreak()
#define assert(x) if ((x)); else DebugBreak()
Note the lack of semicolons at the end of the macro expansions, and the
change to avoid the dangling else problem.
>+#ifdef APR_POOL_DEBUG
>+#define APR_STRINGIFY(S) APR_REALLY_STRINGIFY(S)
>+#define APR_REALLY_STRINGIFY(S) #S
>+#endif
>
Here you define APR_STRINGIFY, ...
>
>+#if defined(APR_POOL_DEBUG)
>+#define apr_pool_alloc_init(p) \
>+ (apr_pool_alloc_init)(p, #p " (" STRINGIFY(__LINE__) ") " __FILE__)
>+#else
>
... but use STRINGIFY later on.
Naughty, naughty.
--
Brane Čibej
home: <br...@xbc.nu> http://www.xbc.nu/brane/
work: <br...@hermes.si> http://www.hermes-softlab.com/
ACM : <br...@acm.org> http://www.acm.org/