diff mbox

[2/3] qdist: use g_realloc_n instead of g_realloc

Message ID 1469459025-23606-3-git-send-email-cota@braap.org (mailing list archive)
State New, archived
Headers show

Commit Message

Emilio Cota July 25, 2016, 3:03 p.m. UTC
While at it, remove the unnecessary parentheses around dist->size.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 util/qdist.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marc-André Lureau July 26, 2016, 8:48 a.m. UTC | #1
Hi

On Mon, Jul 25, 2016 at 7:03 PM, Emilio G. Cota <cota@braap.org> wrote:
> While at it, remove the unnecessary parentheses around dist->size.
>
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
>  util/qdist.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/util/qdist.c b/util/qdist.c
> index eb2236c..cc31140 100644
> --- a/util/qdist.c
> +++ b/util/qdist.c
> @@ -62,8 +62,8 @@ void qdist_add(struct qdist *dist, double x, long count)
>
>      if (unlikely(dist->n == dist->size)) {
>          dist->size *= 2;
> -        dist->entries = g_realloc(dist->entries,
> -                                  sizeof(*dist->entries) * (dist->size));
> +        dist->entries = g_realloc_n(dist->entries, dist->size,
> +                                    sizeof(*dist->entries));
>      }
>      dist->n++;
>      entry = &dist->entries[dist->n - 1];
> --
> 2.5.0
>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
diff mbox

Patch

diff --git a/util/qdist.c b/util/qdist.c
index eb2236c..cc31140 100644
--- a/util/qdist.c
+++ b/util/qdist.c
@@ -62,8 +62,8 @@  void qdist_add(struct qdist *dist, double x, long count)
 
     if (unlikely(dist->n == dist->size)) {
         dist->size *= 2;
-        dist->entries = g_realloc(dist->entries,
-                                  sizeof(*dist->entries) * (dist->size));
+        dist->entries = g_realloc_n(dist->entries, dist->size,
+                                    sizeof(*dist->entries));
     }
     dist->n++;
     entry = &dist->entries[dist->n - 1];