commit bda0aff4b242fe4bc9d1caa281e10f557b92cb34
parent 4f9834be61da935505c0e4eccd34a05b1e2c5fc3
Author: Oliver Lowe <o@olowe.co>
Date: Tue, 2 Sep 2025 14:36:55 +1000
Assume C99 and POSIX
Diffstat:
21 files changed, 11 insertions(+), 228 deletions(-)
diff --git a/Makefile.am b/Makefile.am
@@ -10,7 +10,7 @@ endif
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = dist-bzip2 dist-xz
-SUBDIRS = po src config doc manual
+SUBDIRS = src config doc manual
EXTRA_DIST = \
ChangeLog \
diff --git a/claws-features.h.in b/claws-features.h.in
@@ -1,3 +1 @@
-#undef HAVE_VALGRIND
#undef USE_GNUTLS
-#undef USE_GPGME
diff --git a/configure.ac b/configure.ac
@@ -44,8 +44,6 @@ if test \( "x$EXTRA_RELEASE" != "x" \); then
VERSION=${VERSION}${EXTRA_RELEASE}${EXTRA_GTK3_VERSION}
fi
-dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
-dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(MAJOR_VERSION)
@@ -82,17 +80,13 @@ AC_CONFIG_HEADERS(config.h)
AC_CONFIG_HEADERS(claws-features.h)
AM_MAINTAINER_MODE
-AC_USE_SYSTEM_EXTENSIONS
-dnl Checks for programs.
-dnl AC_ARG_PROGRAM
AC_PROG_CC
AC_SEARCH_LIBS([strerror],[cposix])
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_CPP
-dnl AC_PROG_RANLIB
AC_PROG_LEX(noyywrap)
AC_PROG_YACC
AC_LIB_PREFIX
@@ -114,7 +108,6 @@ fi
AC_SUBST(AM_CFLAGS)
-dnl Checks for iconv
AM_ICONV
dnl floor and ceil are in -lm
@@ -135,18 +128,10 @@ AC_ARG_ENABLE(oauth2,
[ --disable-oauth2 Do not build OAuth2 support],
[enable_oauth2=$enableval], [enable_oauth2=yes])
-AC_ARG_ENABLE(valgrind,
- [ --disable-valgrind Do not build valgrind support for debugging],
- [enable_valgrind=$enableval], [enable_valgrind=yes])
-
AC_ARG_ENABLE(tests,
[ --enable-tests Build unit tests],
[enable_tests=$enableval], [enable_tests=no])
-AC_ARG_ENABLE(more-addressbook-debug,
- [ --enable-more-addressbook-debug Build with additional addressbook debug calls],
- [enable_more_addressbook_debug=$enableval], [enable_more_addressbook_debug=no])
-
dnl Set PACKAGE_DATA_DIR in config.h.
if test "x${datarootdir}" = 'x${prefix}/share'; then
if test "x${prefix}" = "xNONE"; then
@@ -170,26 +155,7 @@ if test "$ac_cv_va_opt" = yes; then
AC_DEFINE([HAVE_VA_OPT], [1], [Define if __VA_OPT__ macro works])
fi
-dnl Checks for header files.
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
- sys/param.h sys/select.h locale.h netdb.h)
-AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
-AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_TYPE_OFF_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_STRUCT_TM
-
-AC_CHECK_SIZEOF(unsigned short, 2)
-AC_CHECK_SIZEOF(unsigned int, 4)
-AC_CHECK_SIZEOF(unsigned long, 4)
-
-dnl Checks for library functions.
AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(strcasestr)
dnl check for glib
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.50 gmodule-2.0 >= 2.50 gobject-2.0 >= 2.50 gthread-2.0 >= 2.50])
@@ -277,23 +243,6 @@ LIBETPAN_CFLAGS=`pkg-config --cflags libetpan`
AC_SUBST(LIBETPAN_CFLAGS)
CPPFLAGS="$CPPFLAGS $LIBETPAN_CFLAGS"
-AC_MSG_CHECKING([whether to use valgrind])
-if test x$enable_valgrind = xyes; then
- AC_MSG_RESULT(yes)
- PKG_CHECK_MODULES([VALGRIND], [valgrind >= 2.4.0],
- [
- AC_DEFINE(HAVE_VALGRIND, 1, Define if you want valgrind support)
- enable_valgrind=yes
- ],
- [
- AC_MSG_NOTICE([valgrind support deactivated as valgrind >= 2.4.0 was not found])
- enable_valgrind=no
- ])
-else
- AC_MSG_RESULT(no)
-fi
-AM_CONDITIONAL(CLAWS_VALGRIND, test x"$enable_valgrind" = x"yes")
-
AC_MSG_CHECKING([whether to build unit tests])
if test x$enable_tests = xyes; then
AC_MSG_RESULT(yes)
@@ -302,17 +251,6 @@ else
fi
AM_CONDITIONAL(BUILD_TESTS, test "x$enable_tests" = "xyes")
-more_debug_output_modules=""
-
-AC_MSG_CHECKING([whether to build addressbook with more debug calls])
-if test x$enable_more_addressbook_debug = xyes; then
- more_debug_output_modules="$more_debug_output_modules AddressBook"
- AC_MSG_RESULT(yes)
- AC_DEFINE(DEBUG_ADDRBOOK, 1, [Define if you want additional addressbook debug calls])
-else
- AC_MSG_RESULT(no)
-fi
-
PKG_CHECK_MODULES(EXPAT, expat, HAVE_EXPAT=yes, HAVE_EXPAT=no)
if test x"$HAVE_EXPAT" = xno; then
@@ -332,10 +270,6 @@ PKG_CHECK_MODULES(CAIRO, cairo >= 1.12.0, HAVE_CAIRO=yes, HAVE_CAIRO=no)
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LIBS)
-PKG_CHECK_MODULES(FONTCONFIG, fontconfig, HAVE_FONTCONFIG=yes, HAVE_FONTCONFIG=no)
-AC_SUBST(FONTCONFIG_CFLAGS)
-AC_SUBST(FONTCONFIG_LIBS)
-
AC_CONFIG_FILES([
Makefile
src/common/version.h
@@ -355,14 +289,6 @@ echo "gnuTLS : $enable_gnutls"
echo "OAuth2 : $enable_oauth2"
echo "iconv : $am_cv_func_iconv"
echo "Unit tests : $enable_tests"
-echo "Valgrind support : $enable_valgrind"
-
-if test -n "$more_debug_output_modules"; then
- echo "Extra debug output enabled for:"
- for module in $more_debug_output_modules; do
- echo " - $module"
- done
-fi
echo ""
echo "The binary will be installed in $prefix/bin"
diff --git a/src/action.c b/src/action.c
@@ -38,9 +38,6 @@
#include <string.h>
#include <errno.h>
#include <sys/types.h>
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
#include <signal.h>
#include <unistd.h>
@@ -195,9 +192,6 @@ ActionType action_get_type(const gchar *action_str)
gboolean in_filtering_action = FALSE;
ActionType action_type = ACTION_NONE;
- cm_return_val_if_fail(action_str, ACTION_ERROR);
- cm_return_val_if_fail(*action_str, ACTION_ERROR);
-
p = action_str;
if (p[0] == '|') {
@@ -365,8 +359,6 @@ static gboolean parse_append_filename(GString *cmd, MsgInfo *msginfo)
{
gchar *filename;
- cm_return_val_if_fail(msginfo, FALSE);
-
filename = procmsg_get_message_file(msginfo);
if (!filename) {
@@ -584,13 +576,8 @@ static void compose_actions_execute(Compose *compose, guint action_nb, GtkWidget
gchar *buf, *action;
ActionType action_type;
- cm_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
-
buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb);
- cm_return_if_fail(buf != NULL);
action = strstr(buf, ": ");
- cm_return_if_fail(action != NULL);
-
/* Point to the beginning of the command-line */
action += 2;
@@ -661,13 +648,8 @@ static void message_actions_execute(MessageView *msgview, guint action_nb,
guint body_pos = 0;
ActionType action_type;
- cm_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
-
buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb);
- cm_return_if_fail(buf);
- cm_return_if_fail((action = strstr(buf, ": ")));
-
/* Point to the beginning of the command-line */
action += 2;
@@ -765,8 +747,6 @@ static gboolean execute_actions(gchar *action, GSList *msg_list,
GtkTextIter start_iter, end_iter;
gboolean is_selection = FALSE;
- cm_return_val_if_fail(action && *action, FALSE);
-
action_type = action_get_type(action);
if (action_type == ACTION_ERROR)
@@ -1239,8 +1219,6 @@ static void update_io_dialog(Children *children)
static void actions_io_size_allocate_cb(GtkWidget *widget,
GtkAllocation *allocation)
{
- cm_return_if_fail(allocation != NULL);
-
gtk_window_get_size(GTK_WINDOW(widget),
&prefs_common.actionsiodialog_width, &prefs_common.actionsiodialog_height);
}
diff --git a/src/common/claws.c b/src/common/claws.c
@@ -24,6 +24,7 @@
#include "defs.h"
#include <stdlib.h>
+#include <locale.h>
#include <glib.h>
#ifdef ENABLE_NLS
#include <glib/gi18n.h>
@@ -32,9 +33,6 @@
#define N_(a) (a)
#endif
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
#include "claws.h"
#include "utils.h"
diff --git a/src/common/codeconv.c b/src/common/codeconv.c
@@ -30,10 +30,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
-
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
#include "codeconv.h"
#include "unmime.h"
diff --git a/src/common/defs.h b/src/common/defs.h
@@ -23,16 +23,6 @@
#include "claws-features.h"
#endif
-#include <glib.h>
-
-#if HAVE_PATHS_H
-# include <paths.h>
-#endif
-
-#if HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-
#define INBOX_DIR "inbox"
#define OUTBOX_DIR "sent"
#define QUEUE_DIR "queue"
@@ -111,25 +101,15 @@
#define DEFAULT_IMAGE_VIEWER_CMD "display '%s'"
#define DEFAULT_AUDIO_PLAYER_CMD "play '%s'"
-#ifdef _PATH_MAILDIR
-# define DEFAULT_SPOOL_PATH _PATH_MAILDIR
-#else
-# define DEFAULT_SPOOL_PATH "/var/spool/mail"
-#endif
-
#define BUFFSIZE 8192
#define RFC822_DATE_BUFFSIZE 128
-#ifndef MAXPATHLEN
-# define MAXPATHLEN 4095
-#endif
-
#define BORDER_WIDTH 2
#define CTREE_INDENT 18
#define FOLDER_SPACING 4
#define MAX_ENTRY_LENGTH 8191
-#define COLOR_DIM ((gdouble)35000 / 65535)
+#define COLOR_DIM ((double)35000 / 65535)
#define UI_REFRESH_INTERVAL 50000 /* usec */
#define FOLDER_UPDATE_INTERVAL 1500 /* msec */
#define PROGRESS_UPDATE_INTERVAL 200 /* msec */
diff --git a/src/common/socket.h b/src/common/socket.h
@@ -24,9 +24,7 @@
#endif
#include <glib.h>
-#if HAVE_NETDB_H
-# include <netdb.h>
-#endif
+#include <netdb.h>
typedef struct _SockInfo SockInfo;
diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
@@ -35,7 +35,6 @@
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <netdb.h>
#include "ssl_certificate.h"
#include "utils.h"
#include "log.h"
diff --git a/src/common/utils.c b/src/common/utils.c
@@ -55,9 +55,7 @@
#include <unistd.h>
#include <stdarg.h>
#include <sys/types.h>
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
+#include <sys/wait.h>
#include <time.h>
#include <regex.h>
@@ -260,16 +258,6 @@ gchar *strcrlftrunc(gchar *str)
return str;
}
-#ifndef HAVE_STRCASESTR
-/* Similar to `strstr' but this function ignores the case of both strings. */
-gchar *strcasestr(const gchar *haystack, const gchar *needle)
-{
- size_t haystack_len = strlen(haystack);
-
- return strncasestr(haystack, haystack_len, needle);
-}
-#endif /* HAVE_STRCASESTR */
-
gchar *strncasestr(const gchar *haystack, gint haystack_len, const gchar *needle)
{
register size_t needle_len;
diff --git a/src/common/utils.h b/src/common/utils.h
@@ -27,10 +27,6 @@
#include "claws-features.h"
#endif
-#ifdef HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
-
#include <glib.h>
#include <glib-object.h>
#include <stdio.h>
@@ -182,45 +178,9 @@ typedef gint64 goffset;
#define IS_ASCII(c) (((guchar) c) <= 0177 ? 1 : 0)
-/* from NetworkManager */
-#if (defined(HAVE_BACKTRACE) && !defined(__FreeBSD__))
-#define print_backtrace() \
-G_STMT_START \
-{ \
- void *_call_stack[512]; \
- int _call_stack_size; \
- char **_symbols; \
- _call_stack_size = backtrace (_call_stack, \
- G_N_ELEMENTS (_call_stack)); \
- _symbols = backtrace_symbols (_call_stack, _call_stack_size); \
- if (_symbols != NULL) \
- { \
- int _i; \
- _i = 0; \
- g_print ("traceback:\n"); \
- while (_i < _call_stack_size) \
- { \
- g_print ("%d:\t%s\n", _i, _symbols[_i]); \
- _i++; \
- } \
- free (_symbols); \
- } \
-} \
-G_STMT_END
-#else
-#define print_backtrace() \
-G_STMT_START \
-{ \
-} \
-G_STMT_END
-#endif
-
-
#define cm_return_val_if_fail(expr,val) G_STMT_START { \
if (!(expr)) { \
g_print("%s:%d Condition %s failed\n", __FILE__, __LINE__, #expr);\
- print_backtrace(); \
- g_print("\n"); \
return val; \
} \
} G_STMT_END
@@ -228,8 +188,6 @@ G_STMT_END
#define cm_return_if_fail(expr) G_STMT_START { \
if (!(expr)) { \
g_print("%s:%d Condition %s failed\n", __FILE__, __LINE__, #expr);\
- print_backtrace(); \
- g_print("\n"); \
return; \
} \
} G_STMT_END
diff --git a/src/compose.c b/src/compose.c
@@ -44,9 +44,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
+#include <sys/wait.h>
#include <wchar.h>
#include <wctype.h>
#include <signal.h>
diff --git a/src/customheader.c b/src/customheader.c
@@ -101,8 +101,6 @@ void custom_header_free(CustomHeader *ch)
gboolean custom_header_is_allowed(const gchar *header)
{
- cm_return_val_if_fail(header != NULL, FALSE);
-
if (g_ascii_strcasecmp(header, "Date") != 0 &&
g_ascii_strcasecmp(header, "From") != 0 &&
g_ascii_strcasecmp(header, "To") != 0 &&
diff --git a/src/gtk/gtksctree.c b/src/gtk/gtksctree.c
@@ -957,7 +957,6 @@ GtkWidget *gtk_sctree_new_with_titles (gint columns, gint tree_column,
if (tree_column >= columns) {
g_warning("wrong tree column");
tree_column = 0;
- print_backtrace();
}
widget = gtk_widget_new (TYPE_GTK_SCTREE,
diff --git a/src/inc.c b/src/inc.c
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <sys/param.h>
#include "main.h"
#include "inc.h"
diff --git a/src/manual.c b/src/manual.c
@@ -26,10 +26,7 @@
#include <glib.h>
#include <string.h>
-
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
#include "prefs_common.h"
#include "manual.h"
diff --git a/src/mbox.c b/src/mbox.c
@@ -30,7 +30,6 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
-#include <sys/file.h>
#include <ctype.h>
#include <time.h>
#include <errno.h>
diff --git a/src/msgcache.c b/src/msgcache.c
@@ -133,8 +133,6 @@ static gboolean msgcache_msginfo_free_func(gpointer num, gpointer msginfo, gpoin
void msgcache_destroy(MsgCache *cache)
{
- cm_return_if_fail(cache != NULL);
-
g_hash_table_foreach_remove(cache->msgnum_table, msgcache_msginfo_free_func, NULL);
g_hash_table_destroy(cache->msgid_table);
g_hash_table_destroy(cache->msgnum_table);
@@ -145,9 +143,6 @@ void msgcache_add_msg(MsgCache *cache, MsgInfo *msginfo)
{
MsgInfo *newmsginfo;
- cm_return_if_fail(cache != NULL);
- cm_return_if_fail(msginfo != NULL);
-
newmsginfo = procmsg_msginfo_new_ref(msginfo);
g_hash_table_insert(cache->msgnum_table, &newmsginfo->msgnum, newmsginfo);
if(newmsginfo->msgid != NULL)
@@ -164,8 +159,6 @@ void msgcache_remove_msg(MsgCache *cache, guint msgnum)
{
MsgInfo *msginfo;
- cm_return_if_fail(cache != NULL);
-
msginfo = (MsgInfo *) g_hash_table_lookup(cache->msgnum_table, &msgnum);
if(!msginfo)
return;
@@ -188,9 +181,6 @@ void msgcache_update_msg(MsgCache *cache, MsgInfo *msginfo)
{
MsgInfo *oldmsginfo, *newmsginfo;
- cm_return_if_fail(cache != NULL);
- cm_return_if_fail(msginfo != NULL);
-
oldmsginfo = g_hash_table_lookup(cache->msgnum_table, &msginfo->msgnum);
if(oldmsginfo && oldmsginfo->msgid)
g_hash_table_remove(cache->msgid_table, oldmsginfo->msgid);
@@ -218,8 +208,6 @@ MsgInfo *msgcache_get_msg(MsgCache *cache, guint num)
{
MsgInfo *msginfo;
- cm_return_val_if_fail(cache != NULL, NULL);
-
msginfo = g_hash_table_lookup(cache->msgnum_table, &num);
if(!msginfo)
return NULL;
@@ -232,9 +220,6 @@ MsgInfo *msgcache_get_msg_by_id(MsgCache *cache, const gchar *msgid)
{
MsgInfo *msginfo;
- cm_return_val_if_fail(cache != NULL, NULL);
- cm_return_val_if_fail(msgid != NULL, NULL);
-
msginfo = g_hash_table_lookup(cache->msgid_table, msgid);
if(!msginfo)
return NULL;
@@ -254,8 +239,6 @@ static void msgcache_get_msg_list_func(gpointer key, gpointer value, gpointer us
MsgInfoList *msgcache_get_msg_list(MsgCache *cache)
{
MsgInfoList *msg_list = NULL;
- cm_return_val_if_fail(cache != NULL, NULL);
-
g_hash_table_foreach((GHashTable *)cache->msgnum_table, msgcache_get_msg_list_func, (gpointer)&msg_list);
cache->last_access = time(NULL);
@@ -265,14 +248,12 @@ MsgInfoList *msgcache_get_msg_list(MsgCache *cache)
time_t msgcache_get_last_access_time(MsgCache *cache)
{
- cm_return_val_if_fail(cache != NULL, 0);
return cache->last_access;
}
gint msgcache_get_memory_usage(MsgCache *cache)
{
- cm_return_val_if_fail(cache != NULL, 0);
return cache->memusage;
}
@@ -395,8 +376,6 @@ static FILE *msgcache_open_data_file(const gchar *file, guint version,
FILE *fp;
gint32 data_ver = 0;
- cm_return_val_if_fail(file != NULL, NULL);
-
if (mode == DATA_WRITE) {
int w_err = 0, wrote = 0;
if ((fp = g_fopen(file, "wb")) == NULL) {
@@ -570,9 +549,6 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file)
char *cache_data = NULL;
struct stat st;
- cm_return_val_if_fail(cache_file != NULL, NULL);
- cm_return_val_if_fail(item != NULL, NULL);
-
swapping = TRUE;
/* In case we can't open the mark file with MARK_VERSION, check if we can open it with the
@@ -935,8 +911,6 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
gchar *new_cache = NULL, *new_mark = NULL;
int w_err = 0, wrote = 0;
- cm_return_val_if_fail(cache != NULL, -1);
-
if (cache_file)
new_cache = g_strconcat(cache_file, ".new", NULL);
if (mark_file)
diff --git a/src/procmime.c b/src/procmime.c
@@ -28,9 +28,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <string.h>
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
+#include <locale.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/src/procmsg.c b/src/procmsg.c
@@ -23,6 +23,7 @@
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/param.h>
#include <ctype.h>
#include <math.h>
diff --git a/src/textview.c b/src/textview.c
@@ -33,9 +33,7 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
-#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
-#endif
#include "main.h"
#include "summaryview.h"