Mark quite a few function prototypes with it.
* prototypes
*/
int alias (char *);
-int akvisible (void);
+int akvisible (void) PURE;
char *akresult (struct aka *);
char *akvalue (char *);
char *akerror (int);
* or NULL if the component is not found in the hash table.
*/
-struct comp *fmt_findcomp(char *component);
+struct comp *fmt_findcomp(char *component) PURE;
/*
* Search for a component structure in the component hash table.
* Identical to fmd_findcomp(), but is case-INSENSITIVE.
*/
-struct comp *fmt_findcasecomp(char *component);
+struct comp *fmt_findcasecomp(char *component) PURE;
/*
* Add a component entry to the component hash table
void add_param_value (contentline *, char *);
void remove_value (value_list *);
struct contentline *find_contentline (contentline *, const char *,
- const char *);
+ const char *) PURE;
void free_contentlines (contentline *);
typedef struct tzdesc *tzdesc_t;
#define CONST __attribute__((const))
#define MALLOC __attribute__((malloc))
#define NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
+#define PURE __attribute__((pure))
#define NMH_UNUSED(i) (void) i
#else
#define NORETURN
#define CONST
#define MALLOC
#define NONNULL(...)
+#define PURE
#define NMH_UNUSED(i) i
#endif
const char *charstring_buffer (const charstring_t) NONNULL(1);
/* User is responsible for free'ing result of buffer copy. */
char *charstring_buffer_copy (const charstring_t) NONNULL(1);
-size_t charstring_bytes (const charstring_t) NONNULL(1);
-size_t charstring_chars (const charstring_t) NONNULL(1);
+size_t charstring_bytes (const charstring_t) NONNULL(1) PURE;
+size_t charstring_chars (const charstring_t) NONNULL(1) PURE;
/* Length of the last character in the charstring. */
int charstring_last_char_len (const charstring_t) NONNULL(1);
void bvector_clear (bvector_t, size_t) NONNULL(1);
void bvector_clear_all (bvector_t) NONNULL(1);
void bvector_set (bvector_t, size_t) NONNULL(1);
-unsigned int bvector_at (bvector_t, size_t) NONNULL(1);
-unsigned long bvector_first_bits (bvector_t) NONNULL(1);
+unsigned int bvector_at (bvector_t, size_t) NONNULL(1) PURE;
+unsigned long bvector_first_bits (bvector_t) NONNULL(1) PURE;
typedef struct svector *svector_t;
void svector_free (svector_t) NONNULL(1);
char *svector_push_back (svector_t, char *) NONNULL(1);
char *svector_at (svector_t, size_t) NONNULL(1);
-char **svector_find(svector_t, const char *) NONNULL(1);
-char **svector_strs (svector_t) NONNULL(1);
-size_t svector_size (svector_t) NONNULL(1);
+char **svector_find(svector_t, const char *) NONNULL(1) PURE;
+char **svector_strs (svector_t) NONNULL(1) PURE;
+size_t svector_size (svector_t) NONNULL(1) PURE;
typedef struct ivector *ivector_t;
void close_encoding (CT);
char *ct_type_str (int) CONST;
char *ct_subtype_str (int, int) CONST;
-int ct_str_type (const char *);
-int ct_str_subtype (int, const char *);
-const struct str2init *get_ct_init (int);
+int ct_str_type (const char *) PURE;
+int ct_str_subtype (int, const char *) PURE;
+const struct str2init *get_ct_init (int) PURE;
const char *ce_str (int) CONST;
-const struct str2init *get_ce_method (const char *);
+const struct str2init *get_ce_method (const char *) PURE;
char *content_charset (CT);
void reverse_alternative_parts (CT);
*
* ct - Content structure to examine
*/
-int is_inline(CT ct);
+int is_inline(CT ct) PURE;
/*
* Given a list of messages, display information about them on standard
*/
typedef struct mhstoreinfo *mhstoreinfo_t;
mhstoreinfo_t mhstoreinfo_create(CT *, char *, const char *, int, int);
-int mhstoreinfo_files_not_clobbered(const mhstoreinfo_t);
+int mhstoreinfo_files_not_clobbered(const mhstoreinfo_t) PURE;
void mhstoreinfo_free(mhstoreinfo_t);
void store_all_messages (mhstoreinfo_t);
* Returns "1" if snoop is enabled, 0 if it is not.
*/
-int netsec_get_snoop(netsec_context *ns_context);
+int netsec_get_snoop(netsec_context *ns_context) PURE;
/*
* Sets "snoop" status; if snoop is set to a nonzero value, network traffic
* supported or in use.
*/
-char *netsec_get_sasl_mechanism(netsec_context *ns_context);
+char *netsec_get_sasl_mechanism(netsec_context *ns_context) PURE;
/*
* Set the OAuth service name used to retrieve the OAuth parameters from
* Never returns NULL.
*/
const char *
-mh_oauth_svc_display_name(const mh_oauth_ctx *ctx);
+mh_oauth_svc_display_name(const mh_oauth_ctx *ctx) PURE;
/*
* Enable logging for subsequent operations on ctx.
* Must not be called if an error was not indicated.
*/
mh_oauth_err_code
-mh_oauth_get_err_code(const mh_oauth_ctx *ctx);
+mh_oauth_get_err_code(const mh_oauth_ctx *ctx) PURE;
/*
* Return null-terminated error message after some function indicated an error.
* Return whether access token is present and not expired at time T.
*/
boolean
-mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred);
+mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred) PURE;
/*
* Free all resources associated with cred.
void argsplit_insert (struct msgs_array *, char *, char **) NONNULL(1, 2, 3);
void arglist_free (char *, char **);
void ambigsw (const char *, const struct swit *) NONNULL(1, 2);
-int atooi(char *) NONNULL(1);
+int atooi(char *) NONNULL(1) PURE;
char **brkstring (char *, char *, char *) NONNULL(1);
/*
void closefds(int);
char *concat (const char *, ...);
int context_del (char *);
-char *context_find (const char *);
+char *context_find (const char *) PURE;
char *context_find_by_type (const char *, const char *, const char *);
-int context_find_prefix(const char *);
+int context_find_prefix(const char *) PURE;
int context_foil (char *);
void context_read (void);
void context_replace (char *, char *);
char *getcpy(const char *str);
char *get_default_editor(void);
-char *getfolder(int);
+char *getfolder(int) PURE;
/*
* Get a string from the terminfo database for the current terminal.
*/
int get_term_numcap(char *capability);
-int m_atoi (char *);
+int m_atoi (char *) PURE;
char *m_backup (const char *);
int m_convert (struct msgs *, char *);
char *m_draft (char *, char *, int, int *);
void m_getfld_track_filepos2(m_getfld_state_t *);
int m_getfld (m_getfld_state_t *, char[NAMESZ], char *, int *, FILE *);
int m_getfld2(m_getfld_state_t *, char[NAMESZ], char *, int *);
-int m_gmprot (void);
+int m_gmprot (void) PURE;
char *m_name (int);
void m_unknown(m_getfld_state_t *, FILE *);
void print_sw (const char *, const struct swit *, char *, FILE *);
void print_version (char *);
void push (void);
-char *r1bindex(char *, int);
+char *r1bindex(char *, int) PURE;
void readconfig (struct node **, FILE *, const char *, int);
int refile (char **, char *);
void seq_setprev (struct msgs *);
void seq_setunseen (struct msgs *, int);
int showfile (char **, char *);
-int smatch(const char *, const struct swit *);
+int smatch(const char *, const struct swit *) PURE;
/*
* Convert a set of bit flags to printable format.
* from least significant bit to most significant.
*/
char *snprintb (char *buffer, size_t size, unsigned flags, char *bitfield);
-int ssequal (const char *, const char *);
-int stringdex (char *, char *);
+int ssequal (const char *, const char *) PURE;
+int stringdex (char *, char *) PURE;
char *trimcpy (char *);
-int uprf (const char *, const char *);
+int uprf (const char *, const char *) PURE;
int vfgets (FILE *, char **);
/*
char *addlist(char *, const char *) MALLOC;
int folder_exists(const char *);
void create_folder(char *, int, void (*)(int));
-int num_digits(int);
+int num_digits(int) PURE;
/*
* A vector of char array, used to hold a list of string message numbers
void app_msgarg(struct msgs_array *, char *);
void app_msgnum(struct msgnum_array *, int);
-char *find_str (const char [], size_t, const char *);
-char *rfind_str (const char [], size_t, const char *);
-char *nmh_strcasestr (const char *, const char *);
+char *find_str (const char [], size_t, const char *) PURE;
+char *rfind_str (const char [], size_t, const char *) PURE;
+char *nmh_strcasestr (const char *, const char *) PURE;
void trunccpy(char *dst, const char *src, size_t size);
/* A convenience for the common case of dst being an array. */
#define TRUNCCPY(dst, src) trunccpy(dst, src, sizeof (dst))
-bool has_prefix(const char *s, const char *prefix);
-bool has_suffix(const char *s, const char *suffix);
-bool has_suffix_c(const char *s, int c);
+bool has_prefix(const char *s, const char *prefix) PURE;
+bool has_suffix(const char *s, const char *suffix) PURE;
+bool has_suffix_c(const char *s, int c) PURE;
void trim_suffix_c(char *s, int c);
void to_lower(char *s);
void to_upper(char *s);
static int smtalk (int time, char *fmt, ...) CHECK_PRINTF(2, 3);
static int sm_wstream (char *, int);
static int smhear (void);
-static char *EHLOset (char *);
+static char *EHLOset (char *) PURE;
static int sm_sasl_callback(enum sasl_message_type, unsigned const char *,
unsigned int, unsigned char **, unsigned int *,
char **);
/*
* static prototypes
*/
-static int match (char *, char *);
+static int match (char *, char *) PURE;
static char *get_x400_friendly (char *, char *, int);
static int get_x400_comp (char *, char *, char *, int);
static int lkopen_flock (const char *, int, mode_t, int *);
#endif /* HAVE_FLOCK */
-static enum locktype init_locktype(const char *);
+static enum locktype init_locktype(const char *) PURE;
static int lkopen_dot (const char *, int, mode_t, int *);
static void lkclose_dot (int, const char *);
char *akerror (int);
static char *akval (struct aka *, char *);
-static bool aleq (char *, char *);
-static char *scanp (char *);
+static bool aleq (char *, char *) PURE;
+static char *scanp (char *) PURE;
static char *getp (char *);
static char *seekp (char *, char *, char **);
static int addfile (struct aka *, char *);
/*
* prototypes
*/
-static int maildir_srt(const void *va, const void *vb);
+static int maildir_srt(const void *va, const void *vb) PURE;
static void inc_done(int) NORETURN;
static int pop_action(void *closure, char *);
static int content_encoding (CT, const char **);
static int strip_crs (CT, int *);
static void update_cte (CT);
-static int least_restrictive_encoding (CT);
+static int least_restrictive_encoding (CT) PURE;
static int less_restrictive (int, int);
static int convert_charsets (CT, char *, int *);
static int fix_always (CT, int *);
static void dump_unfolded (FILE *, contentline *);
static void output (FILE *, contentline *, int);
static void display (FILE *, contentline *, char *);
-static const char *identity (const contentline *);
+static const char *identity (const contentline *) PURE;
static char *format_params (char *, param_list *);
static char *fold (char *, int);
static char *parse (void);
static void process (char *, char *, int, int);
static void mhlfile (FILE *, char *, int, int);
-static int mcomp_flags (char *);
+static int mcomp_flags (char *) PURE;
static char *mcomp_add (unsigned long, char *, char *);
static void mcomp_format (struct mcomp *, struct mcomp *);
static struct mcomp *add_queue (struct mcomp **, struct mcomp **, char *, char *, int);
/*
* prototypes
*/
-int part_ok (CT);
-int part_exact(CT ct);
+int part_ok (CT) PURE;
+int part_exact(CT ct) PURE;
int type_ok (CT, int);
void content_error (char *, CT, char *, ...) CHECK_PRINTF(3, 4);
void flush_errors (void);
/*
* static prototypes
*/
-static char *p_find(char *);
+static char *p_find(char *) PURE;
int
NMH_CLOBBER_NEVER
};
-static enum clobber_policy_t clobber_policy (const char *);
+static enum clobber_policy_t clobber_policy (const char *) PURE;
struct mhstoreinfo {
CT *cts; /* Top-level list of contents to store. */
/*
* static prototypes
*/
-static int donote (char *, int);
+static int donote (char *, int) PURE;
static int checkmail (char *, char *, int, int, int);
static int remotemail (char *, char *, char *, char *, int, int, int, int,
char *, int, const char *);
static void putfmt (char *, char *, int *, FILE *);
static void start_headers (void);
static void finish_headers (FILE *);
-static int get_header (char *, struct headers *);
+static int get_header (char *, struct headers *) PURE;
static int putadr (char *, char *, struct mailname *, FILE *, unsigned int,
char *, unsigned int);
static void putgrp (char *, char *, FILE *, unsigned int);
static void insert_fcc (struct headers *, char *);
static void make_bcc_file (int);
static void verify_all_addresses (int, int, char *, int, char *);
-static void chkadr (void);
+static void chkadr (void) PURE;
static void sigon (void);
static void sigoff (void);
static void p_refile (char *);
static int parse (int);
static void expand (char *, char *, int);
static void glob (int);
-static struct pair *lookup (struct pair *, char *);
+static struct pair *lookup (struct pair *, char *) PURE;
static int logged_in (void);
static int timely (char *, char *);
static int usr_file (int, char *, int);