comparison lib/base32.c @ 17180:e0def4d44688

base32, base64: no need for 'inline' * lib/base32.c (to_uchar, get_8, decode_8): * lib/base64.c (to_uchar, get_4, decode_4): Change 'static inline' to 'inline'. * m4/base32.m4 (gl_PREREQ_BASE32): * m4/base64.m4 (gl_PREREQ_BASE64): Do not require AC_C_INLINE.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 20 Nov 2012 22:25:08 -0800
parents bb182ee4a09d
children e542fd46ad6f
comparison
equal deleted inserted replaced
17179:bbfb83985261 17180:e0def4d44688
49 #include <limits.h> 49 #include <limits.h>
50 50
51 #include <string.h> 51 #include <string.h>
52 52
53 /* C89 compliant way to cast 'char' to 'unsigned char'. */ 53 /* C89 compliant way to cast 'char' to 'unsigned char'. */
54 static inline unsigned char 54 static unsigned char
55 to_uchar (char ch) 55 to_uchar (char ch)
56 { 56 {
57 return ch; 57 return ch;
58 } 58 }
59 59
300 4 - CTX->i non-newline bytes from that range into CTX->buf, starting at 300 4 - CTX->i non-newline bytes from that range into CTX->buf, starting at
301 index CTX->i and setting CTX->i to reflect the number of bytes copied, 301 index CTX->i and setting CTX->i to reflect the number of bytes copied,
302 and return CTX->buf. In either case, advance *IN to point to the byte 302 and return CTX->buf. In either case, advance *IN to point to the byte
303 after the last one processed, and set *N_NON_NEWLINE to the number of 303 after the last one processed, and set *N_NON_NEWLINE to the number of
304 verified non-newline bytes accessible through the returned pointer. */ 304 verified non-newline bytes accessible through the returned pointer. */
305 static inline char * 305 static char *
306 get_8 (struct base32_decode_context *ctx, 306 get_8 (struct base32_decode_context *ctx,
307 char const *restrict *in, char const *restrict in_end, 307 char const *restrict *in, char const *restrict in_end,
308 size_t *n_non_newline) 308 size_t *n_non_newline)
309 { 309 {
310 if (ctx->i == 8) 310 if (ctx->i == 8)
354 into the output buffer, *OUT, of size *OUTLEN bytes. Return true if 354 into the output buffer, *OUT, of size *OUTLEN bytes. Return true if
355 decoding is successful, false otherwise. If *OUTLEN is too small, 355 decoding is successful, false otherwise. If *OUTLEN is too small,
356 as many bytes as possible are written to *OUT. On return, advance 356 as many bytes as possible are written to *OUT. On return, advance
357 *OUT to point to the byte after the last one written, and decrement 357 *OUT to point to the byte after the last one written, and decrement
358 *OUTLEN to reflect the number of bytes remaining in *OUT. */ 358 *OUTLEN to reflect the number of bytes remaining in *OUT. */
359 static inline bool 359 static bool
360 decode_8 (char const *restrict in, size_t inlen, 360 decode_8 (char const *restrict in, size_t inlen,
361 char *restrict *outp, size_t *outleft) 361 char *restrict *outp, size_t *outleft)
362 { 362 {
363 char *out = *outp; 363 char *out = *outp;
364 if (inlen < 8) 364 if (inlen < 8)