1- <!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.119 2006/11/23 05:28:18 neilc Exp $ -->
1+ <!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.120 2006/11/23 05:43:32 neilc Exp $ -->
22
33 <sect1 id="xfunc">
44 <title>User-Defined Functions</title>
@@ -1587,7 +1587,7 @@ memcpy(destination->data, buffer, 40);
15871587 </sect2>
15881588
15891589 <sect2>
1590- <title>Calling Conventions Version 0for C-Language Functions </title>
1590+ <title>Version 0Calling Conventions </title>
15911591
15921592 <para>
15931593 We present the <quote>old style</quote> calling convention first — although
@@ -1651,7 +1651,7 @@ copytext(text *t)
16511651 */
16521652 memcpy((void *) VARDATA(new_t), /* destination */
16531653 (void *) VARDATA(t), /* source */
1654- VARSIZE(t)- VARHDRSZ); /* how many bytes */
1654+ VARSIZE(t) - VARHDRSZ); /* how many bytes */
16551655 return new_t;
16561656}
16571657
@@ -1662,9 +1662,9 @@ concat_text(text *arg1, text *arg2)
16621662 text *new_text = (text *) palloc(new_text_size);
16631663
16641664 VARATT_SIZEP(new_text) = new_text_size;
1665- memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)- VARHDRSZ);
1666- memcpy(VARDATA(new_text) + (VARSIZE(arg1)- VARHDRSZ),
1667- VARDATA(arg2), VARSIZE(arg2)- VARHDRSZ);
1665+ memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1) - VARHDRSZ);
1666+ memcpy(VARDATA(new_text) + (VARSIZE(arg1) - VARHDRSZ),
1667+ VARDATA(arg2), VARSIZE(arg2) - VARHDRSZ);
16681668 return new_text;
16691669}
16701670</programlisting>
@@ -1735,7 +1735,7 @@ CREATE FUNCTION concat_text(text, text) RETURNS text
17351735 </sect2>
17361736
17371737 <sect2>
1738- <title>Calling Conventions Version 1for C-Language Functions </title>
1738+ <title>Version 1Calling Conventions </title>
17391739
17401740 <para>
17411741 The version-1 calling convention relies on macros to suppress most
@@ -1837,7 +1837,7 @@ copytext(PG_FUNCTION_ARGS)
18371837 */
18381838 memcpy((void *) VARDATA(new_t), /* destination */
18391839 (void *) VARDATA(t), /* source */
1840- VARSIZE(t)- VARHDRSZ); /* how many bytes */
1840+ VARSIZE(t) - VARHDRSZ); /* how many bytes */
18411841 PG_RETURN_TEXT_P(new_t);
18421842}
18431843
@@ -1852,9 +1852,9 @@ concat_text(PG_FUNCTION_ARGS)
18521852 text *new_text = (text *) palloc(new_text_size);
18531853
18541854 VARATT_SIZEP(new_text) = new_text_size;
1855- memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)- VARHDRSZ);
1856- memcpy(VARDATA(new_text) + (VARSIZE(arg1)- VARHDRSZ),
1857- VARDATA(arg2), VARSIZE(arg2)- VARHDRSZ);
1855+ memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1) - VARHDRSZ);
1856+ memcpy(VARDATA(new_text) + (VARSIZE(arg1) - VARHDRSZ),
1857+ VARDATA(arg2), VARSIZE(arg2) - VARHDRSZ);
18581858 PG_RETURN_TEXT_P(new_text);
18591859}
18601860</programlisting>
@@ -2261,7 +2261,7 @@ include $(PGXS)
22612261
22622262
22632263 <sect2>
2264- <title>Composite-Type Arguments in C-Language Functions </title>
2264+ <title>Composite-Type Arguments</title>
22652265
22662266 <para>
22672267 Composite types do not have a fixed layout like C structures.
@@ -2366,7 +2366,7 @@ CREATE FUNCTION c_overpaid(emp, integer) RETURNS boolean
23662366 </sect2>
23672367
23682368 <sect2>
2369- <title>Returning Rows (Composite Types) from C-Language Functions </title>
2369+ <title>Returning Rows (Composite Types)</title>
23702370
23712371 <para>
23722372 To return a row or composite-type value from a C-language
@@ -2517,7 +2517,7 @@ HeapTupleGetDatum(HeapTuple tuple)
25172517 </sect2>
25182518
25192519 <sect2 id="xfunc-c-return-set">
2520- <title>Returning Sets from C-Language Functions </title>
2520+ <title>Returning Sets</title>
25212521
25222522 <para>
25232523 There is also a special API that provides support for returning
@@ -2910,30 +2910,30 @@ CREATE FUNCTION make_array(anyelement) RETURNS anyarray
29102910 </para>
29112911 </sect2>
29122912 <sect2>
2913- <title>Shared Memory and LWLocks in C-Language Functions </title>
2913+ <title>Shared Memory and LWLocks</title>
29142914
29152915 <para>
29162916 Add-ins may reserve LWLocks and an allocation of shared memory on server
2917- startup. The add-in's shared library must be preloaded, by specifying
2917+ startup. The add-in's shared library must be preloaded by specifying
29182918 it in
2919- <xref linkend="guc-shared-preload-libraries"><indexterm><primary>shared-preload-libraries</></>,
2920- and the shared memorymust be reserved by calling:
2919+ <xref linkend="guc-shared-preload-libraries"><indexterm><primary>shared-preload-libraries</></>.
2920+ Shared memoryis reserved by calling:
29212921<programlisting>
29222922void RequestAddinShmemSpace(int size)
29232923</programlisting>
29242924 from your <function>_PG_init</> function.
29252925 </para>
29262926 <para>
2927- LWLocks are reserved by calling:
2927+ LWLocks are reserved by calling:
29282928<programlisting>
29292929void RequestAddinLWLocks(int n)
29302930</programlisting>
2931- from <function>_PG_init</>.
2931+ from <function>_PG_init</>.
29322932 </para>
29332933 <para>
2934- To avoid possible race-conditions, each backend should use the LWLock
2935- <function>AddinShmemInitLock</> when connecting to and initializing
2936- its allocation of shared memory, as shown here:
2934+ To avoid possible race-conditions, each backend should use the LWLock
2935+ <function>AddinShmemInitLock</> when connecting to and initializing
2936+ its allocation of shared memory, as shown here:
29372937<programlisting>
29382938 static mystruct *ptr = NULL;
29392939