summaryrefslogtreecommitdiff
path: root/doc/libunistring_2.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/libunistring_2.html')
-rw-r--r--doc/libunistring_2.html31
1 files changed, 26 insertions, 5 deletions
diff --git a/doc/libunistring_2.html b/doc/libunistring_2.html
index d9da4378..2b644c18 100644
--- a/doc/libunistring_2.html
+++ b/doc/libunistring_2.html
@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
-<!-- Created on October, 16 2022 by texi2html 1.78a -->
+<!-- Created on February, 24 2024 by texi2html 1.78a -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
@@ -51,7 +51,7 @@ ul.toc {list-style: none}
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libunistring_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libunistring_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
-<td valign="middle" align="left">[<a href="libunistring_21.html#SEC92" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="libunistring_21.html#SEC94" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
@@ -76,7 +76,7 @@ order mark. Their units are 2-byte words.
order mark. Their units are 4-byte words.
</p>
<p>Argument pairs <code>(<var>s</var>, <var>n</var>)</code> denote a string
-<code><var>s</var>[0..<var>n</var>-1]</code> with exactly <var>n</var> units.
+<code><var>s</var>[0..<var>n</var>-1]</code> with exactly <var>n</var> units.<a name="DOCF1" href="libunistring_fot.html#FOOT1">(1)</a>
</p>
<p>All functions with prefix &lsquo;<samp>ulc_</samp>&rsquo; operate on C strings in locale
encoding.
@@ -116,6 +116,27 @@ is returned. In both cases, <code>*<var>lengthp</var></code> is set to the
length (number of units) of the returned string. In case of error,
NULL is returned and <code>errno</code> is set.
</p>
+<p>To invoke such a function:
+</p><ul>
+<li>
+First ask yourself whether you want to accept the overhead of a
+<code>malloc</code> invocation even for a small-sized result.
+If yes, pass NULL as <var>resultbuf</var>.
+If no, allocate an array of units on the stack, typically between 50 and
+4000 bytes large; pass this array as <var>resultbuf</var>; and initialize
+<code>*<var>lengthp</var></code> to the number of units of this array.
+</li><li>
+Upon return from such a function, look at the return value:
+NULL means an error; look at the value of <code>errno</code> in this case.
+Otherwise, the return value is the result, with <code>*<var>lengthp</var></code>
+units. Note that the function has <em>not</em> added an extra NUL
+character at the end.
+</li><li>
+Finally, do memory management. You know that the result was
+<code>malloc</code>-allocated if it is <code>!= NULL</code> and
+<code>!= <var>resultbuf</var></code>.
+</li></ul>
+
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="libunistring_1.html#SEC1" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
@@ -127,12 +148,12 @@ NULL is returned and <code>errno</code> is set.
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libunistring_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libunistring_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
-<td valign="middle" align="left">[<a href="libunistring_21.html#SEC92" title="Index">Index</a>]</td>
+<td valign="middle" align="left">[<a href="libunistring_21.html#SEC94" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
- This document was generated by <em>Bruno Haible</em> on <em>October, 16 2022</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.
+ This document was generated by <em>Bruno Haible</em> on <em>February, 24 2024</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.
</font>
<br>