Skip to content

Commit cbbc552

Browse files
committed
Added some const qualifiers
CVS-ID: mailbox.c 1.31 CVS-ID: mailbox.h 1.4
1 parent 5f3d6bc commit cbbc552

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

mailbox.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static idx_msgnum_t num_by_aday[N_ADAY + 1];
4545
static idx_msgnum_t msg_num; /* number of actual messages in msgs[] */
4646
static idx_msgnum_t msg_alloc; /* (pre)allocated size of msgs[] (in messages) */
4747
static struct idx_message *msgs; /* flat array */
48-
static char *list;
48+
static const char *list;
4949

5050
struct mem_message {
5151
struct idx_message *msg;
@@ -60,7 +60,7 @@ struct parsed_message {
6060
struct tm tm;
6161
idx_hash_t msgid_hash, irt_hash;
6262
int have_msgid, have_irt;
63-
char *from, *subject;
63+
const char *from, *subject;
6464
};
6565

6666
/* allocate new message in msgs[] */
@@ -534,7 +534,7 @@ static int mailbox_parse_fd(int fd)
534534
}
535535
msg.tm.tm_year = 0;
536536
if (line[length - 1] == '\n') {
537-
char *p = memchr(line + 5, ' ', length - 5);
537+
const char *p = memchr(line + 5, ' ', length - 5);
538538
if (p) {
539539
p = strptime(p, " %a %b %d %T %Y", &msg.tm);
540540
if (!p || *p != '\n')
@@ -594,7 +594,7 @@ static int mailbox_parse_fd(int fd)
594594
case 'i':
595595
if (eq(p, l, "Message-ID:", 11) ||
596596
eq(p, l, "In-Reply-To:", 12)) {
597-
char *q;
597+
const char *q;
598598
p = mime_decode_header(&mime);
599599
while (*p && *p != '<')
600600
p++;
@@ -663,7 +663,7 @@ static int mailbox_parse_fd(int fd)
663663
p++;
664664
msg.subject = p;
665665
while ((p = strchr(p, '['))) {
666-
char *q;
666+
const char *q;
667667
if (strncasecmp(++p, list, strlen(list)))
668668
continue;
669669
q = p + strlen(list);
@@ -704,10 +704,11 @@ static int mailbox_parse_fd(int fd)
704704
return !done;
705705
}
706706

707-
int mailbox_parse(char *mailbox)
707+
int mailbox_parse(const char *mailbox)
708708
{
709+
const char *p;
709710
int fd, idx_fd;
710-
char *idx, *p;
711+
char *idx;
711712
off_t idx_size;
712713
size_t msgs_size;
713714
int error;

mailbox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
/*
1818
* Opens, parses, and closes the mailbox. Returns a non-zero value on error.
1919
*/
20-
extern int mailbox_parse(char *mailbox);
20+
extern int mailbox_parse(const char *mailbox);
2121

2222
#endif

0 commit comments

Comments
 (0)