One patch for README, one for dFree (no need to check for NULL) and one for sizeof usage.
Why isn't the NULL-check needed? free(NULL) has an undefinied behavior... /Fredrik 2012/5/26 123 <p37sitdu at lavabit.com>
One patch for README, one for dFree (no need to check for NULL) and one for sizeof usage.
_______________________________________________ Dillo-dev mailing list Dillo-dev at dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
Sry, my bad. Never mind 2012/5/26 Fredrik Gustafsson <iveqy at iveqy.com>
Why isn't the NULL-check needed? free(NULL) has an undefinied behavior...
/Fredrik
2012/5/26 123 <p37sitdu at lavabit.com>
One patch for README, one for dFree (no need to check for NULL) and one for sizeof usage.
_______________________________________________ Dillo-dev mailing list Dillo-dev at dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
On Sat, May 26, 2012 at 02:02:17PM +0200, Johannes Hofmann wrote:
On Sat, May 26, 2012 at 03:02:24PM +0400, 123 wrote:
One patch for README, one for dFree (no need to check for NULL) and one for sizeof usage.
thanks, committed.
BTW, why is it better to have sizeof this way? - (sizeof(Css_shorthand_info) / sizeof(CssShorthandInfo)) + (sizeof(Css_shorthand_info) / sizeof(Css_shorthand_info[0])) -- Cheers Jorge.-
On Sat, May 26, 2012 at 09:26:39AM -0400, Jorge Arellano Cid wrote:
On Sat, May 26, 2012 at 02:02:17PM +0200, Johannes Hofmann wrote:
On Sat, May 26, 2012 at 03:02:24PM +0400, 123 wrote:
One patch for README, one for dFree (no need to check for NULL) and one for sizeof usage.
thanks, committed.
BTW, why is it better to have sizeof this way?
- (sizeof(Css_shorthand_info) / sizeof(CssShorthandInfo)) + (sizeof(Css_shorthand_info) / sizeof(Css_shorthand_info[0]))
This way it stays correct even if someone changes the type of Css_shorthand_info to say CssShorthandInfo2. Not a big improvement, but I like it being consistently done like that. Cheers, Johannes
Hi 123, why not introducing a macro like #define LENGTH(X) (sizeof (X) / sizeof (X)[0]) which could be used in all these for loops? I think this would make the code simpler and less error prone. Best, Alexander
On Sat, May 26, 2012 at 03:59:12PM +0200, Alexander Voigt wrote:
Hi 123,
why not introducing a macro like
#define LENGTH(X) (sizeof (X) / sizeof (X)[0])
which could be used in all these for loops? I think this would make the code simpler and less error prone.
I'm not a fan of hiding this in macros. Something like struct foo * f = malloc(sizeof(struct foo) * 10); for(int i = 0; i < LENGTH(f); i++) { looks even more unsuspicious than with the sizeof stuff visible. Cheers, Johannes
participants (5)
-
Hole.destructor@gmx.de
-
iveqy@iveqy.com
-
jcid@dillo.org
-
Johannes.Hofmann@gmx.de
-
p37sitdu@lavabit.com