commit d1ddde91044de95e07bc9dd0750e79b68befccf4
parent 34c08d4a32daf5761e8af037c82b284d43112135
Author: Mario Rosell R. Martinez <mario@mariorosell.es>
Date: Sat, 28 Mar 2026 21:58:33 +0100
anntp_overview: Add anntp_overview_free
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/anntp.h b/anntp.h
@@ -196,6 +196,7 @@ ANNTP_API int anntp_group(AnntpConnection* conn, const char* group,
ANNTP_API ssize_t anntp_article(AnntpConnection*, size_t num, AnntpArticle* out_art);
ANNTP_API void anntp_article_free(AnntpArticle* art);
ANNTP_API int anntp_article_cb(AnntpConnection* cv, size_t n, AnntpLineCb cb, void* extra);
+ANNTP_API void anntp_overview_free(AnntpOverview* ov)
ANNTP_API ssize_t anntp_overview(AnntpConnection* cv, size_t start, size_t end, AnntpOverview* ov);
ANNTP_API int anntp_overview_cb(AnntpConnection*, size_t start, size_t end, AnntpLineCb, void*);
ANNTP_API ssize_t anntp_write_all(AnntpConnection* conn, const uchar_t* buf, size_t bufsize);
@@ -794,7 +795,23 @@ anntp_readdot(AnntpConnection* cv, char* buf, size_t maxlen)
return (ssize_t)pos;
}
+void
+anntp_overview_free(AnntpOverview* ov)
+{
+ if (!ov)
+ return;
+ if (ov->lines) {
+ for (size_t i = 0; i < ov->count; i++) {
+ if (ov->lines[i])
+ ANNTP_FREE(ov->lines[i]);
+ }
+ ANNTP_FREE(ov->lines);
+ }
+
+ ov->lines = NULL;
+ ov->count = 0;
+}
int
anntp_readdot_cb(AnntpConnection* cv, AnntpLineCb cb, void* extra)