From 3957b47e59f696a936b20db98043155e73c6c277 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 23 Nov 2023 13:31:16 +0000 Subject: [PATCH] docs: Move the checkedmath SECTION Move it to a separate Markdown file. Signed-off-by: Philip Withnall Helps: #3037 --- docs/reference/glib/checked-math.md | 30 +++++++++++++++++++++++++++++ docs/reference/glib/glib.toml.in | 1 + docs/reference/glib/meson.build | 1 + glib/docs.c | 21 -------------------- 4 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 docs/reference/glib/checked-math.md diff --git a/docs/reference/glib/checked-math.md b/docs/reference/glib/checked-math.md new file mode 100644 index 000000000..b16a4a272 --- /dev/null +++ b/docs/reference/glib/checked-math.md @@ -0,0 +1,30 @@ +Title: Bounds-checking Integer Arithmetic +SPDX-License-Identifier: LGPL-2.1-or-later +SPDX-FileCopyrightText: 2015 Allison Lortie + +# Bounds-checking Integer Arithmetic + +GLib offers a set of macros for doing additions and multiplications +of unsigned integers, with checks for overflows. + +The helpers all have three arguments. A pointer to the destination +is always the first argument and the operands to the operation are +the other two. + +Following standard GLib convention, the helpers return true in case +of success (ie: no overflow). + +The helpers may be macros, normal functions or inlines. They may be +implemented with inline assembly or compiler intrinsics where +available. + +Since: 2.48 + +The APIs are: + + * [func@GLib.uint_checked_add] + * [func@GLib.uint_checked_mul] + * [func@GLib.uint64_checked_add] + * [func@GLib.uint64_checked_mul] + * [func@GLib.size_checked_add] + * [func@GLib.size_checked_mul] diff --git a/docs/reference/glib/glib.toml.in b/docs/reference/glib/glib.toml.in index a30589a92..67df4adbd 100644 --- a/docs/reference/glib/glib.toml.in +++ b/docs/reference/glib/glib.toml.in @@ -68,6 +68,7 @@ content_files = [ "reference-counting.md", "testing.md", "atomic.md", + "checked-math.md", "threads.md", "spawn.md", "unix.md", diff --git a/docs/reference/glib/meson.build b/docs/reference/glib/meson.build index 919808c5e..f8417c8ba 100644 --- a/docs/reference/glib/meson.build +++ b/docs/reference/glib/meson.build @@ -149,6 +149,7 @@ expand_content_files = [ 'base64.md', 'building.md', 'character-set.md', + 'checked-math.md', 'compiling.md', 'cross-compiling.md', 'datalist-and-dataset.md', diff --git a/glib/docs.c b/glib/docs.c index ca66d7eeb..22e867097 100644 --- a/glib/docs.c +++ b/glib/docs.c @@ -1702,27 +1702,6 @@ */ /* Bounds-checked integer arithmetic {{{1 */ -/** - * SECTION:checkedmath - * @title: Bounds-checking integer arithmetic - * @short_description: a set of helpers for performing checked integer arithmetic - * - * GLib offers a set of macros for doing additions and multiplications - * of unsigned integers, with checks for overflows. - * - * The helpers all have three arguments. A pointer to the destination - * is always the first argument and the operands to the operation are - * the other two. - * - * Following standard GLib convention, the helpers return %TRUE in case - * of success (ie: no overflow). - * - * The helpers may be macros, normal functions or inlines. They may be - * implemented with inline assembly or compiler intrinsics where - * available. - * - * Since: 2.48 - */ /** * g_uint_checked_add