mirror of
https://github.com/postgres/postgres.git
synced 2025-08-06 18:42:54 +03:00
Replace int2/int4 in C code with int16/int32
The latter was already the dominant use, and it's preferable because in C the convention is that intXX means XX bits. Therefore, allowing mixed use of int2, int4, int8, int16, int32 is obviously confusing. Remove the typedefs for int2 and int4 for now. They don't seem to be widely used outside of the PostgreSQL source tree, and the few uses can probably be cleaned up by the time this ships.
This commit is contained in:
@@ -1739,6 +1739,13 @@ PG_MODULE_MAGIC;
|
||||
/* 4-byte integer, passed by value */
|
||||
typedef int int4;
|
||||
</programlisting>
|
||||
|
||||
(The actual PostgreSQL C code calls this type <type>int32</type>, because
|
||||
it is a convention in C that <type>int<replaceable>XX</replaceable></type>
|
||||
means <replaceable>XX</replaceable> <emphasis>bits</emphasis>. Note
|
||||
therefore also that the C type <type>int8</type> is 1 byte in size. The
|
||||
SQL type <type>int8</type> is called <type>int64</type> in C. See also
|
||||
<xref linkend="xfunc-c-type-table">.)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -1801,7 +1808,7 @@ typedef struct
|
||||
|
||||
<programlisting>
|
||||
typedef struct {
|
||||
int4 length;
|
||||
int32 length;
|
||||
char data[1];
|
||||
} text;
|
||||
</programlisting>
|
||||
@@ -1913,7 +1920,7 @@ memcpy(destination->data, buffer, 40);
|
||||
</row>
|
||||
<row>
|
||||
<entry><type>smallint</type> (<type>int2</type>)</entry>
|
||||
<entry><type>int2</type> or <type>int16</type></entry>
|
||||
<entry><type>int16</type></entry>
|
||||
<entry><filename>postgres.h</filename></entry>
|
||||
</row>
|
||||
<row>
|
||||
@@ -1923,7 +1930,7 @@ memcpy(destination->data, buffer, 40);
|
||||
</row>
|
||||
<row>
|
||||
<entry><type>integer</type> (<type>int4</type>)</entry>
|
||||
<entry><type>int4</type> or <type>int32</type></entry>
|
||||
<entry><type>int32</type></entry>
|
||||
<entry><filename>postgres.h</filename></entry>
|
||||
</row>
|
||||
<row>
|
||||
|
Reference in New Issue
Block a user