From: Michael Witten <mfwitten@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 2/4] Clean: Remove superfluous strbuf 'docs'
Date: Tue, 15 Feb 2011 23:12:04 +0000 [thread overview]
Message-ID: <5bddd028-bf38-46b9-a189-bdb09038dfdd-mfwitten@gmail.com> (raw)
In-Reply-To: <1fbceaa8-398c-44ec-8833-a03e4cca6805-mfwitten@gmail.com>
Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
strbuf.h | 37 +------------------------------------
1 files changed, 1 insertions(+), 36 deletions(-)
diff --git a/strbuf.h b/strbuf.h
index f722331..07060ce 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -1,42 +1,7 @@
#ifndef STRBUF_H
#define STRBUF_H
-/*
- * Strbuf's can be use in many ways: as a byte array, or to store arbitrary
- * long, overflow safe strings.
- *
- * Strbufs has some invariants that are very important to keep in mind:
- *
- * 1. the ->buf member is always malloc-ed, hence strbuf's can be used to
- * build complex strings/buffers whose final size isn't easily known.
- *
- * It is NOT legal to copy the ->buf pointer away.
- * `strbuf_detach' is the operation that detaches a buffer from its shell
- * while keeping the shell valid wrt its invariants.
- *
- * 2. the ->buf member is a byte array that has at least ->len + 1 bytes
- * allocated. The extra byte is used to store a '\0', allowing the ->buf
- * member to be a valid C-string. Every strbuf function ensures this
- * invariant is preserved.
- *
- * Note that it is OK to "play" with the buffer directly if you work it
- * that way:
- *
- * strbuf_grow(sb, SOME_SIZE);
- * ... Here, the memory array starting at sb->buf, and of length
- * ... strbuf_avail(sb) is all yours, and you are sure that
- * ... strbuf_avail(sb) is at least SOME_SIZE.
- * strbuf_setlen(sb, sb->len + SOME_OTHER_SIZE);
- *
- * Of course, SOME_OTHER_SIZE must be smaller or equal to strbuf_avail(sb).
- *
- * Doing so is safe, though if it has to be done in many places, adding the
- * missing API to the strbuf module is the way to go.
- *
- * XXX: do _not_ assume that the area that is yours is of size ->alloc - 1
- * even if it's true in the current implementation. Alloc is somehow a
- * "private" member that should not be messed with.
- */
+/* See Documentation/technical/api-strbuf.txt */
#include <assert.h>
--
1.7.4.18.g68fe8
next prev parent reply other threads:[~2011-03-30 17:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 16:13 [PATCH 0/4] Miscellaneous Improvements Michael Witten
2011-02-22 17:15 ` [PATCH 1/4] Typos: t/README Michael Witten
2011-02-15 23:12 ` Michael Witten [this message]
2011-03-02 15:25 ` [PATCH 3/4] Clean: Remove unnecessary `\' (line continuation) Michael Witten
2011-02-11 17:48 ` [PATCH 4/4] Clean: Remove useless parameters from both get_commit_info() functions Michael Witten
2011-03-30 19:21 ` [PATCH 3/4] Clean: Remove unnecessary `\' (line continuation) Junio C Hamano
2011-03-30 18:58 ` [PATCH 1/4] Typos: t/README Junio C Hamano
2011-03-30 19:02 ` Michael Witten
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bddd028-bf38-46b9-a189-bdb09038dfdd-mfwitten@gmail.com \
--to=mfwitten@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).