Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / protocols / zephyr / et_name.c
blob52d503a921328e81b1f6a16a1d51af0464f5b67a
1 /*
2 * Copyright 1987 by MIT Student Information Processing Board
4 * For copyright info, see mit-sipb-copyright.h.
5 */
7 #include <sysdep.h>
10 #define ERRCODE_RANGE 8 /* # of bits to shift table number */
11 #define BITS_PER_CHAR 6 /* # bits to shift per character in name */
14 static const char char_set[] =
15 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
17 /* Prototypes for -Wmissing-prototypes */
18 const char * error_table_name(int num);
19 const char * error_table_name_r(int num, char *buf);
21 const char * error_table_name_r(int num, char *buf)
23 int ch;
24 int i;
25 char *p;
27 /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */
28 p = buf;
29 num >>= ERRCODE_RANGE;
30 /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
31 num &= 077777777;
32 /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
33 for (i = 4; i >= 0; i--) {
34 ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1);
35 if (ch != 0)
36 *p++ = char_set[ch-1];
38 *p = '\0';
39 return(buf);
42 const char * error_table_name(int num)
44 static char buf[6];
46 return(error_table_name_r(num, buf));