From c6c157a5adb58c321563f51f7034a1ea7a7ea89d Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 7 Oct 2020 04:24:10 -0400 Subject: [PATCH] notcurses_stats_alloc() everywhere --- NEWS.md | 2 +- USAGE.md | 2 +- include/notcurses/notcurses.h | 2 +- rust/src/nc.rs | 3 ++- src/lib/internal.h | 2 +- src/lib/notcurses.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index e8dd7712b..b4544a209 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,7 +9,7 @@ rearrangements of Notcurses. these processes. * `notcurses_render_to_buffer()` has been added, allowing user control of the process of writing frames out to the terminal. - * `notcurses_stats_create()` has been added, to allocate an `ncstats` object. + * `notcurses_stats_alloc()` has been added, to allocate an `ncstats` object. `notcurses_reset_stats()` has been renamed `notcurses_stats_reset()`. * 1.7.5 (2020-09-29) diff --git a/USAGE.md b/USAGE.md index 0a7ce08e8..83c18a243 100644 --- a/USAGE.md +++ b/USAGE.md @@ -2851,7 +2851,7 @@ typedef struct ncstats { // Allocate an ncstats object. Use this rather than allocating your own, since // future versions of Notcurses might enlarge this structure. -ncstats* notcurses_stats_create(const struct notcurses* nc); +ncstats* notcurses_stats_alloc(const struct notcurses* nc); // Acquire an atomic snapshot of the notcurses object's stats. void notcurses_stats(const struct notcurses* nc, ncstats* stats); diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 390b4eea3..accf82c8a 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -1121,7 +1121,7 @@ typedef struct ncstats { // Allocate an ncstats object. Use this rather than allocating your own, since // future versions of Notcurses might enlarge this structure. -API ncstats* notcurses_stats_create(const struct notcurses* nc); +API ncstats* notcurses_stats_alloc(const struct notcurses* nc); // Acquire an atomic snapshot of the notcurses object's stats. API void notcurses_stats(const struct notcurses* nc, ncstats* stats); diff --git a/rust/src/nc.rs b/rust/src/nc.rs index cfb97ced5..adbd63e63 100644 --- a/rust/src/nc.rs +++ b/rust/src/nc.rs @@ -24,7 +24,8 @@ // notcurses_refresh // notcurses_render // notcurses_render_to_file -// notcurses_reset_stats +// notcurses_stats_alloc +// notcurses_stats_reset // notcurses_stats // notcurses_stdplane // notcurses_stdplane_const diff --git a/src/lib/internal.h b/src/lib/internal.h index 7e2326f00..5ada1b695 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -310,7 +310,7 @@ typedef struct notcurses { int cursorx; // care, otherwise moved here after each render. ncstats stats; // some statistics across the lifetime of the notcurses ctx - ncstats stashstats; // cumulative stats, unaffected by notcurses_reset_stats() + ncstats stashstats; // cumulative stats, unaffected by notcurses_stats_reset() int truecols; // true number of columns in the physical rendering area. // used only to see if output motion takes us to the next diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 2858291d8..0c6c09dc7 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -715,7 +715,7 @@ void notcurses_stats(const notcurses* nc, ncstats* stats){ memcpy(stats, &nc->stats, sizeof(*stats)); } -ncstats* notcurses_stats_create(const notcurses* nc __attribute__ ((unused))){ +ncstats* notcurses_stats_alloc(const notcurses* nc __attribute__ ((unused))){ return malloc(sizeof(ncstats)); }