]> git.notmuchmail.org Git - notmuch/blob - util/hex-escape.h
cli: replace use of g_mime_message_get_recipients
[notmuch] / util / hex-escape.h
1 #ifndef _HEX_ESCAPE_H
2 #define _HEX_ESCAPE_H
3
4 typedef enum hex_status {
5     HEX_SUCCESS = 0,
6     HEX_SYNTAX_ERROR,
7     HEX_OUT_OF_MEMORY
8 } hex_status_t;
9
10 /*
11  * The API for hex_encode() and hex_decode() is modelled on that for
12  * getline.
13  *
14  * If 'out' points to a NULL pointer a char array of the appropriate
15  * size is allocated using talloc, and out_size is updated.
16  *
17  * If 'out' points to a non-NULL pointer, it assumed to describe an
18  * existing char array, with the size given in *out_size.  This array
19  * may be resized by talloc_realloc if needed; in this case *out_size
20  * will also be updated.
21  *
22  * Note that it is an error to pass a NULL pointer for any parameter
23  * of these routines.
24  */
25
26 hex_status_t
27 hex_encode (void *talloc_ctx, const char *in, char **out,
28             size_t *out_size);
29
30 hex_status_t
31 hex_decode (void *talloc_ctx, const char *in, char **out,
32             size_t *out_size);
33
34 /*
35  * Non-allocating hex decode to decode 's' in-place. The length of the
36  * result is always equal to or shorter than the length of the
37  * original.
38  */
39 hex_status_t
40 hex_decode_inplace (char *s);
41 #endif