[balsa: 2/3] Various: Replace libbalsa_str_has_prefix()
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa: 2/3] Various: Replace libbalsa_str_has_prefix()
- Date: Tue, 17 May 2022 17:08:25 +0000 (UTC)
commit 84dc14ea73d17bb82daf2e99cefd5e646cb26957
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue May 17 13:04:57 2022 -0400
Various: Replace libbalsa_str_has_prefix()
with g_str_has_prefix(), and stop defining the former as the latter.
Thanks to @albrecht for the suggestion!
https://gitlab.gnome.org/GNOME/balsa/-/merge_requests/59#note_1457564
modified: libbalsa/mailbox_mh.c
modified: libbalsa/misc.h
modified: src/sendmsg-window.c
libbalsa/mailbox_mh.c | 18 +++++++++---------
libbalsa/misc.h | 1 -
src/sendmsg-window.c | 5 +++--
3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/libbalsa/mailbox_mh.c b/libbalsa/mailbox_mh.c
index 945518803..76f075c38 100644
--- a/libbalsa/mailbox_mh.c
+++ b/libbalsa/mailbox_mh.c
@@ -397,13 +397,13 @@ lbm_mh_handle_seq_line(LibBalsaMailboxMh * mh, gchar * line)
LibBalsaMessageFlag flag;
gchar **sequences, **seq;
- if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhUnseen))
+ if (g_str_has_prefix(line, LibBalsaMailboxMhUnseen))
flag = LIBBALSA_MESSAGE_FLAG_NEW;
- else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhFlagged))
+ else if (g_str_has_prefix(line, LibBalsaMailboxMhFlagged))
flag = LIBBALSA_MESSAGE_FLAG_FLAGGED;
- else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhReplied))
+ else if (g_str_has_prefix(line, LibBalsaMailboxMhReplied))
flag = LIBBALSA_MESSAGE_FLAG_REPLIED;
- else if (libbalsa_str_has_prefix(line, LibBalsaMailboxMhRecent))
+ else if (g_str_has_prefix(line, LibBalsaMailboxMhRecent))
flag = LIBBALSA_MESSAGE_FLAG_RECENT;
else /* unknown sequence */
return;
@@ -548,7 +548,7 @@ lbm_mh_check(LibBalsaMailboxMh * mh, const gchar * path)
g_mime_stream_buffer_readln(gmime_stream_buffer, line);
g_byte_array_append(line, zero, 1);
- if (libbalsa_str_has_prefix((gchar *) line->data,
+ if (g_str_has_prefix((gchar *) line->data,
LibBalsaMailboxMhUnseen)) {
/* Found the "unseen: " line... */
gchar *p = (gchar *) line->data + strlen(LibBalsaMailboxMhUnseen);
@@ -908,10 +908,10 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox * mailbox, gboolean expunge)
g_mime_stream_buffer_readln(gmime_stream_buffer, line);
buf = (gchar *) line->data;
if (buf &&
- !libbalsa_str_has_prefix(buf, LibBalsaMailboxMhUnseen) &&
- !libbalsa_str_has_prefix(buf, LibBalsaMailboxMhFlagged) &&
- !libbalsa_str_has_prefix(buf, LibBalsaMailboxMhReplied) &&
- !libbalsa_str_has_prefix(buf, LibBalsaMailboxMhRecent)) {
+ !g_str_has_prefix(buf, LibBalsaMailboxMhUnseen) &&
+ !g_str_has_prefix(buf, LibBalsaMailboxMhFlagged) &&
+ !g_str_has_prefix(buf, LibBalsaMailboxMhReplied) &&
+ !g_str_has_prefix(buf, LibBalsaMailboxMhRecent)) {
/* unknown sequence */
g_mime_stream_write(temp_stream, buf, line->len);
}
diff --git a/libbalsa/misc.h b/libbalsa/misc.h
index f0e8eca9a..23d9c6c72 100644
--- a/libbalsa/misc.h
+++ b/libbalsa/misc.h
@@ -130,7 +130,6 @@ int libbalsa_safe_open (const char *path, int flags, mode_t mode, GError **err);
int libbalsa_lock_file (const char *path, int fd, int excl, int dot, int timeout);
int libbalsa_unlock_file (const char *path, int fd, int dot);
int libbalsa_safe_rename (const char *src, const char *target);
-#define libbalsa_str_has_prefix(str, prefix) g_str_has_prefix((str), (prefix))
gboolean libbalsa_ia_rfc2821_equal(const InternetAddress * a,
const InternetAddress * b);
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 47558dec1..e6edd43dd 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -733,7 +733,7 @@ edit_with_gnome_check(GPid pid,
break;
}
- if (libbalsa_str_has_prefix(line, _("Subject:"))) {
+ if (g_str_has_prefix(line, _("Subject:"))) {
gtk_entry_set_text(GTK_ENTRY(bsmsg->subject[1]),
line + strlen(_("Subject:")) + 1);
continue;
@@ -743,11 +743,12 @@ edit_with_gnome_check(GPid pid,
type < G_N_ELEMENTS(address_types);
type++) {
const gchar *type_string = _(address_types[type]);
- if (libbalsa_str_has_prefix(line, type_string))
+ if (g_str_has_prefix(line, type_string)) {
libbalsa_address_view_set_from_string
(bsmsg->recipient_view,
address_types[type],
line + strlen(type_string) + 1);
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]