From: Matthew Fernandez Date: Sun, 28 Aug 2022 20:19:54 +0000 (-0700) Subject: gvmap add_point: abbreviate no-op 'MAX' call X-Git-Tag: 6.0.1~14^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc34310fd3d30e88a7e8748db921dd073edb481f;p=graphviz gvmap add_point: abbreviate no-op 'MAX' call c193a91a0e9d8565e85bd6953a2c64e971d6ab79 seems to have incorrectly assumed multiplication has a higher precedence than casts. In reality, it is the opposite, meaning the first parameter to this `MAX` call was always 0. So the entire expression would evaluate to 20. Empirically this seems to have been fine since this code has been in use for over a decade with no specific problems blamed on this area. So lets just abbreviate it into what it evaluates to. Gitlab: #2269 --- diff --git a/cmd/gvmap/make_map.c b/cmd/gvmap/make_map.c index 4e8316556..6e9da497e 100644 --- a/cmd/gvmap/make_map.c +++ b/cmd/gvmap/make_map.c @@ -1297,7 +1297,7 @@ static void add_point(int *n, int igrp, double **x, int *nmax, double point[], i if (*n >= *nmax){ int old_nmax = *nmax; - *nmax = MAX((int) 0.2*(*n), 20) + *n; + *nmax = 20 + *n; *x = gv_recalloc(*x, 2 * old_nmax, 2 * *nmax, sizeof(double)); *groups = gv_recalloc(*groups, old_nmax, *nmax, sizeof(int)); }