Module Name: src
Committed By: uwe
Date: Wed Oct 9 00:55:24 UTC 2024
Modified Files:
src/share/man/man3: container_of.3
Log Message:
container_of(3): fix return type, don't indent example
There's no text around example so the indentation doesn't serve any
useful purpose and just wastes horizontal space. It's not too nice
given a lengthy line in the example.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man3/container_of.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/man/man3/container_of.3
diff -u src/share/man/man3/container_of.3:1.1 src/share/man/man3/container_of.3:1.2
--- src/share/man/man3/container_of.3:1.1 Tue Oct 8 23:11:21 2024
+++ src/share/man/man3/container_of.3 Wed Oct 9 00:55:24 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: container_of.3,v 1.1 2024/10/08 23:11:21 christos Exp $
+.\" $NetBSD: container_of.3,v 1.2 2024/10/09 00:55:24 uwe Exp $
.\"
.\" Copyright (c) 2024 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -33,14 +33,14 @@
container structure.
.Sh SYNOPSIS
.In sys/container_of.h
-.Ft type
+.Ft "type *"
.Fn container_of "pointer" "type" "member"
.Sh DESCRIPTION
Given a
.Fa pointer
that points to a
.Fa member
-of the container
+of the container structure
.Fa type
the
.Fn container_of
@@ -48,22 +48,23 @@ macro returns a pointer that points to t
.Pp
A compiler error will result if
.Ar member
-is not aligned to a byte boundary (i.e. it is a bit-field).
+is not aligned to a byte boundary
+.Pq i.e. it is a bit-field .
.Sh EXAMPLES
-.Bd -literal -offset indent
+.Bd -literal
#include <assert.h>
#include <sys/container_of.h>
struct container {
- double other_member;
- int member;
+ double other_member;
+ int member;
};
struct container one;
void test(void) {
- int *ptr = &one.member;
- struct container *onep = container_of(ptr, struct container, member);
- assert(onep == &one);
+ int *ptr = &one.member;
+ struct container *onep = container_of(ptr, struct container, member);
+ assert(onep == &one);
}
.Ed
.Sh SEE ALSO