]> granicus.if.org Git - postgresql/blob - src/port/strerror.c
Optimize pg_comp_crc32c_sse42 routine slightly, and also use it on x86.
[postgresql] / src / port / strerror.c
1 /* src/port/strerror.c */
2
3 /*
4  * strerror - map error number to descriptive string
5  *
6  * This version is obviously somewhat Unix-specific.
7  *
8  * based on code by Henry Spencer
9  * modified for ANSI by D'Arcy J.M. Cain
10  */
11
12 #include "c.h"
13
14
15 extern const char *const sys_errlist[];
16 extern int      sys_nerr;
17
18 const char *
19 strerror(int errnum)
20 {
21         static char buf[24];
22
23         if (errnum < 0 || errnum > sys_nerr)
24         {
25                 sprintf(buf, _("unrecognized error %d"), errnum);
26                 return buf;
27         }
28
29         return sys_errlist[errnum];
30 }