summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2011-09-19 17:55:38 +0200
committerportix <portix@gmx.net>2011-09-19 17:55:38 +0200
commite5d8c756e67538c341791fcec97a21a08be13f24 (patch)
tree0eb83bd3099c408e0f5c6d748ea8eafcafba90bc /src/util.c
parent6ab4fc95240fd1e8d135fa43fdea8afa8386fcfb (diff)
downloaddwb-e5d8c756e67538c341791fcec97a21a08be13f24.zip
Remove history, bookmarks, quickmarks
--HG-- branch : develop
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 8776f7c5..1b0e1f75 100644
--- a/src/util.c
+++ b/src/util.c
@@ -192,6 +192,10 @@ int
util_navigation_compare_second(Navigation *a, Navigation *b) {
return (strcmp(a->second, b->second));
}/*}}}*/
+int
+util_quickmark_compare(Quickmark *a, Quickmark *b) {
+ return strcmp(a->key, b->key);
+}
/* util_keymap_sort_first(KeyMap *, KeyMap *) {{{*/
int
util_keymap_sort_first(KeyMap *a, KeyMap *b) {
@@ -325,6 +329,14 @@ util_get_data_file(const char *filename) {
}
return NULL;
}
+static inline int
+util_strcmp_skip_newline(const char *s1, const char *s2) {
+ char *nl = strstr(s2, "\n");
+ if (nl != NULL)
+ return strncmp(s1, s2, nl - s1);
+ else
+ return strcmp(s1, s2);
+}
int
util_file_remove_line(const char *filename, const char *line) {
int ret = 1;
@@ -332,7 +344,7 @@ util_file_remove_line(const char *filename, const char *line) {
char **lines = g_strsplit(content, "\n", -1);
GString *buffer = g_string_new(NULL);
for (int i=0; lines[i]; i++) {
- if (strlen(lines[i]) > 0 && STRCMP_SKIP_NEWLINE(lines[i], line)) {
+ if (strlen(lines[i]) > 0 && STRCMP_FIRST_WORD(lines[i], line)) {
g_string_append_printf(buffer, "%s\n", lines[i]);
}
}