history handling
Hi all, it is possible to rewrite the handling of history in mc? Currently everything stored, every time, w/o filtering the duplicates. The history file contains one directory / command / search string f.ex. 10 times... And why logged the used directories? But I can't turn off this. Best regards, rezso signature.asc Description: PGP signature ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [155fd32] Revert second bunch of mhl patches (see 9b9cab58749217101ab16504a77efb301812cfbf)
The following commit has been merged in the master branch: commit 155fd328a4b9f085d1f44ea710a5dee4a7d67f3e Author: Patrick Winnertz win...@debian.org Date: Thu Feb 5 23:18:38 2009 +0100 Revert second bunch of mhl patches (see 9b9cab58749217101ab16504a77efb301812cfbf) This reintroduce GString again and drop the use of mhl_mem_free in some files Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/edit/edit.c b/edit/edit.c index 36284df..e853a96 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -274,20 +274,22 @@ edit_insert_file (WEdit *edit, const char *filename) edit_insert_stream (edit, f); edit_cursor_move (edit, current - edit-curs1); if (pclose (f) 0) { - char errmsg[8192]; - snprintf(errmsg, sizeof(errmsg), _( Error reading from pipe: %s ), p); - edit_error_dialog (_(Error), errmsg); - mhl_mem_free (p); + GString *errmsg = g_string_new (NULL); + g_string_sprintf (errmsg, _( Error reading from pipe: %s ), p); + edit_error_dialog (_(Error), errmsg-str); + g_string_free (errmsg, TRUE); + g_free (p); return 0; } } else { - char errmsg[8192]; - snprintf(errmsg, sizeof(errmsg), _( Cannot open pipe for reading: %s ), p); - edit_error_dialog (_(Error), errmsg); - mhl_mem_free (p); + GString *errmsg = g_string_new (NULL); + g_string_sprintf (errmsg, _( Cannot open pipe for reading: %s ), p); + edit_error_dialog (_(Error), errmsg-str); + g_string_free (errmsg, TRUE); + g_free (p); return 0; } - mhl_mem_free (p); + g_free (p); } else { int i, file, blocklen; long current = edit-curs1; diff --git a/src/utilunix.c b/src/utilunix.c index 4cf70dc..5dfa18e 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -590,7 +590,7 @@ putenv (char *string) size * sizeof (char *)); new_environ[size] = (char *) string; new_environ[size + 1] = NULL; - mhl_mem_free ((void *) last_environ); + g_free ((void *) last_environ); last_environ = new_environ; __environ = new_environ; } -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [281652c] Use FALSE/TRUE in favour of false/true (reverts 4fcf4e9685d9b2e4b49bfa3f7d3709dbe48073b6)
The following commit has been merged in the master branch: commit 281652cc23a4733b23e8fd5b779e1522913bbc78 Author: Patrick Winnertz win...@debian.org Date: Thu Feb 5 23:41:40 2009 +0100 Use FALSE/TRUE in favour of false/true (reverts 4fcf4e9685d9b2e4b49bfa3f7d3709dbe48073b6) Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/edit/usermap.c b/edit/usermap.c index fb06124..bbc0dd7 100644 --- a/edit/usermap.c +++ b/edit/usermap.c @@ -255,7 +255,7 @@ cfg_free_maps(config_t *cfg) static GPtrArray * split_line(char *str) { -bool inside_quote = false; +bool inside_quote = FALSE; int move = 0; GPtrArray *args; @@ -356,7 +356,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[]) if (argc != 3) { snprintf(error_msg, sizeof(error_msg), _(bind: Wrong argument number, bind key command)); - return false; + return FALSE; } keyname = argv[1]; @@ -378,7 +378,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[]) if (!m) { /* incorrect key */ snprintf(error_msg, sizeof(error_msg), _(bind: Bad key value `%s'), keyname); - return false; + return FALSE; } mod |= m; m = 0; @@ -391,7 +391,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[]) /* no key */ if (keyname[0] == '\0') { snprintf(error_msg, sizeof(error_msg), _(bind: Ehh...no key?)); - return false; + return FALSE; } /* ordinary key */ @@ -405,7 +405,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[]) if (k 0 !key-name) { snprintf(error_msg, sizeof(error_msg), _(bind: Unknown key: `%s'), keyname); - return false; + return FALSE; } while (cmd-name strcasecmp(cmd-name, command) != 0) @@ -414,7 +414,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[]) if (!cmd-name) { snprintf(error_msg, sizeof(error_msg), _(bind: Unknown command: `%s'), command); - return false; + return FALSE; } if (mod KEY_M_CTRL) { @@ -435,7 +435,7 @@ cmd_bind(config_t *cfg, int argc, char *argv[]) else keymap_add(cfg-keymap, k, cmd-val); -return true; +return TRUE; } #if 0 @@ -482,7 +482,7 @@ cmd_label(config_t *cfg, int argc, char *argv[]) snprintf(error_msg, sizeof(error_msg), _(%s: Syntax: %s n command label), argv[0], argv[0]); - return false; + return FALSE; } fn = strtol(argv[1], NULL, 0); @@ -495,19 +495,19 @@ cmd_label(config_t *cfg, int argc, char *argv[]) if (!cmd-name) { snprintf(error_msg, sizeof(error_msg), _(%s: Unknown command: `%s'), argv[0], command); - return false; + return FALSE; } if (fn 1 || fn 10) { snprintf(error_msg, sizeof(error_msg), _(%s: fn should be 1-10), argv[0]); - return false; + return FALSE; } keymap_add(cfg-keymap, KEY_F(fn), cmd-val); cfg-labels[fn - 1] = g_strdup(label); -return true; +return TRUE; } @@ -522,7 +522,7 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd) if (!fp) { snprintf(error_msg, sizeof(error_msg), _(%s: fopen(): %s), file, strerror(errno)); - return false; + return FALSE; } while (fgets(buf, sizeof(buf), fp)) { @@ -549,7 +549,7 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd) argv[0]); g_ptr_array_free(args, TRUE); fclose(fp); - return false; + return FALSE; } if (!(c-handler(cfg, args-len, argv))) { @@ -559,13 +559,13 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd) g_free(ss); g_ptr_array_free(args, TRUE); fclose(fp); - return false; + return FALSE; } g_ptr_array_free(args, TRUE); } fclose(fp); -return true; +return TRUE; } static bool @@ -582,10 +582,10 @@ load_user_keymap(config_t *cfg, const char *file) cfg-ext_keymap = g_array_new(TRUE, FALSE, sizeof(edit_key_map_type)); if (!parse_file(cfg, file, cmd)) { - return false; + return FALSE; } -return true; +return TRUE; } bool @@ -597,7 +597,7 @@ edit_load_user_map(WEdit *edit) struct stat s; if (edit_key_emulation != EDIT_KEY_EMULATION_USER) - return true; + return TRUE; file = mhl_str_dir_plus_file(home_dir, MC_USERMAP); @@ -606,7 +606,7 @@ edit_load_user_map(WEdit *edit) edit_error_dialog(_(Error), msg); g_free(msg); g_free(file); - return false; + return FALSE; } if (s.st_mtime != cfg.mtime) { @@ -617,7 +617,7 @@ edit_load_user_map(WEdit *edit)
updated: [0450daf] Removed type SHELL_ESCAPED_STR in favour of plain char*
The following commit has been merged in the master branch: commit 0450daf56672a75df543c8222353c8042de8c7a1 Author: Patrick Winnertz win...@debian.org Date: Fri Feb 6 00:09:35 2009 +0100 Removed type SHELL_ESCAPED_STR in favour of plain char* Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/ChangeLog b/ChangeLog index a4b977f..3fd7ee3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,7 +40,7 @@ 2009-01-30 Enrico Weigelt, metux ITS weig...@metux.de - * replaced calls to g_free() by g_free() + * replaced calls to g_free() by mhl_mem_free() 2009-01-29 Mikhail S. Pobolovets styx...@gmail.com diff --git a/mhl/escape.h b/mhl/escape.h index 485579c..3f07d62 100644 --- a/mhl/escape.h +++ b/mhl/escape.h @@ -17,9 +17,6 @@ #define mhl_shell_escape_nottoesc(x) \ (((x)!=0) (!mhl_shell_escape_toesc((x -/* type for escaped string - just for a bit more type safety ;-p */ -typedef struct { char* s; } SHELL_ESCAPED_STR; - /** To be compatible with the general posix command lines we have to escape strings for the command line @@ -28,10 +25,10 @@ typedef struct { char* s; } SHELL_ESCAPED_STR; /returns return escaped string (later need to free) */ -static inline SHELL_ESCAPED_STR mhl_shell_escape_dup(const char* src) +static inline char* mhl_shell_escape_dup(const char* src) { if ((src==NULL)||(!(*src))) - return (SHELL_ESCAPED_STR){ .s = strdup() }; + return strdup(); char* buffer = calloc(1, strlen(src)*2+2); char* ptr = buffer; @@ -50,7 +47,7 @@ static inline SHELL_ESCAPED_STR mhl_shell_escape_dup(const char* src) /* at this point we either have an \0 or an char to escape */ if (!c) - return (SHELL_ESCAPED_STR){ .s = buffer }; + return buffer; *ptr = '\\'; ptr++; diff --git a/src/complete.c b/src/complete.c index ed4dfcd..6a7b19d 100644 --- a/src/complete.c +++ b/src/complete.c @@ -206,9 +206,7 @@ filename_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags) if (temp (flags INPUT_COMPLETE_SHELL_ESC)) { - SHELL_ESCAPED_STR e_temp = mhl_shell_escape_dup(temp); - g_free (temp); - temp = e_temp.s; + temp = mhl_shell_escape_dup(temp); } return temp; } @@ -486,9 +484,8 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags) p = filename_completion_function (text, state, flags); if (!p) return 0; - SHELL_ESCAPED_STR e_p = mhl_shell_escape_dup(p); - g_free(p); - return e_p.s; + p = mhl_shell_escape_dup(p); + return p; } found = NULL; @@ -543,9 +540,9 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags) } if ((p = strrchr (found, PATH_SEP)) != NULL) { p++; - SHELL_ESCAPED_STR e_p = mhl_shell_escape_dup(p); + p = mhl_shell_escape_dup(p); g_free(found); - return e_p.s; + return p; } return found; diff --git a/vfs/fish.c b/vfs/fish.c index 06cf483..397d310 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -367,7 +367,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) char buffer[8192]; struct vfs_s_entry *ent = NULL; FILE *logfile; -SHELL_ESCAPED_STR quoted_path; +char *quoted_path; int reply_code; #if 0 @@ -462,7 +462,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) else\n echo '### 500'\n fi\n, - quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s); + quoted_path, quoted_path, quoted_path, quoted_path, quoted_path, quoted_path); g_free (quoted_path.s); ent = vfs_s_generate_entry(me, NULL, dir, 0); while (1) { @@ -618,7 +618,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc struct stat s; int was_error = 0; int h; -SHELL_ESCAPED_STR quoted_name; +char *quoted_name; h = open (localname, O_RDONLY); @@ -659,7 +659,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc */ quoted_name = mhl_shell_escape_dup(name); -print_vfs_message(_(fish: store %s: sending command...), quoted_name.s ); +print_vfs_message(_(fish: store %s: sending command...), quoted_name ); /* FIXME: File size is limited to ULONG_MAX */ if (!fh-u.fish.append) @@ -683,8 +683,8 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc rest=`expr $rest - $n`\n done\n }; echo '### 200'\n, -(unsigned long) s.st_size, quoted_name.s, -quoted_name.s, (unsigned long) s.st_size, +(unsigned long) s.st_size, quoted_name, +quoted_name, (unsigned long)
updated: [ae987b9] Reverted the use of bool in favour of gboolean
The following commit has been merged in the master branch: commit ae987b923e5341422bdc3048079ce2c5a2b8dd2f Author: Patrick Winnertz win...@debian.org Date: Thu Feb 5 23:46:07 2009 +0100 Reverted the use of bool in favour of gboolean Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/edit/usermap.c b/edit/usermap.c index bbc0dd7..e30c011 100644 --- a/edit/usermap.c +++ b/edit/usermap.c @@ -59,7 +59,7 @@ typedef struct Config { typedef struct Command { const char *name; -bool (*handler) (config_t *cfg, int argc, char *argv[]); +int (*handler) (config_t *cfg, int argc, char *argv[]); } command_t; static char error_msg[200] = Nobody see this; @@ -255,7 +255,7 @@ cfg_free_maps(config_t *cfg) static GPtrArray * split_line(char *str) { -bool inside_quote = FALSE; +gboolean inside_quote = FALSE; int move = 0; GPtrArray *args; @@ -345,7 +345,7 @@ keymap_add(GArray *keymap, int key, int cmd) } /* bind key command */ -static bool +static gboolean cmd_bind(config_t *cfg, int argc, char *argv[]) { char *keyname, *command; @@ -471,7 +471,7 @@ static void edit_my_define (Dlg_head * h, int idx, const char *text, #endif /* label number command label */ -static bool +static gboolean cmd_label(config_t *cfg, int argc, char *argv[]) { const name_map_t *cmd = command_names; @@ -511,7 +511,7 @@ cmd_label(config_t *cfg, int argc, char *argv[]) } -static bool +static gboolean parse_file(config_t *cfg, const char *file, const command_t *cmd) { char buf[200]; @@ -568,7 +568,7 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd) return TRUE; } -static bool +static gboolean load_user_keymap(config_t *cfg, const char *file) { const command_t cmd[] = { @@ -588,7 +588,7 @@ load_user_keymap(config_t *cfg, const char *file) return TRUE; } -bool +gboolean edit_load_user_map(WEdit *edit) { static config_t cfg; diff --git a/edit/usermap.h b/edit/usermap.h index bf06d12..fecf03b 100644 --- a/edit/usermap.h +++ b/edit/usermap.h @@ -1,13 +1,11 @@ #ifndef MC_USERMAP_H #define MC_USERMAP_H -#include mhl/types.h - #define MC_USERMAP .mc/cedit/cooledit.bindings #include edit.h /* load user map */ -bool edit_load_user_map(WEdit *); +gboolean edit_load_user_map(WEdit *); #endif diff --git a/src/ecs-test.c b/src/ecs-test.c index e7f64e5..a194280 100644 --- a/src/ecs-test.c +++ b/src/ecs-test.c @@ -29,13 +29,11 @@ #include locale.h #include stdio.h -#include mhl/types.h - #include global.h #include ecs.h #ifdef EXTCHARSET_ENABLED -static bool +static gboolean change_locale(const char *loc) { const char *ident; @@ -67,7 +65,7 @@ test_locale_en_US_UTF_8(void) const char *teststr_c = Zuckert\374te; ecs_char *ecs; char *mbs; - boolvalid; + gbooleanvalid; if (!change_locale(en_US.UTF-8)) return; diff --git a/src/ecs.c b/src/ecs.c index 62683a6..89ef8e0 100644 --- a/src/ecs.c +++ b/src/ecs.c @@ -37,7 +37,7 @@ * String type conversion */ -extern bool ecs_mbstr_to_str(ecs_char **ret_str, const char *s) +extern gboolean ecs_mbstr_to_str(ecs_char **ret_str, const char *s) { #ifdef EXTCHARSET_ENABLED size_t maxlen, len; @@ -61,7 +61,7 @@ extern bool ecs_mbstr_to_str(ecs_char **ret_str, const char *s) #endif } -extern bool ecs_str_to_mbstr(char **ret_str, const ecs_char *s) +extern gboolean ecs_str_to_mbstr(char **ret_str, const ecs_char *s) { #ifdef EXTCHARSET_ENABLED size_t maxlen, len; @@ -103,57 +103,57 @@ extern bool ecs_str_to_mbstr(char **ret_str, const ecs_char *s) (cf(c)) #endif -extern bool ecs_isalnum(ecs_char c) +extern gboolean ecs_isalnum(ecs_char c) { return ECS_CTYPE(iswalnum, isalnum, c); } -extern bool ecs_isalpha(ecs_char c) +extern gboolean ecs_isalpha(ecs_char c) { return ECS_CTYPE(iswalpha, isalpha, c); } -extern bool ecs_iscntrl(ecs_char c) +extern gboolean ecs_iscntrl(ecs_char c) { return ECS_CTYPE(iswcntrl, iscntrl, c); } -extern bool ecs_isdigit(ecs_char c) +extern gboolean ecs_isdigit(ecs_char c) { return ECS_CTYPE(iswdigit, isdigit, c); } -extern bool ecs_isgraph(ecs_char c) +extern gboolean ecs_isgraph(ecs_char c) { return ECS_CTYPE(iswgraph, isgraph, c); } -extern bool ecs_islower(ecs_char c) +extern gboolean ecs_islower(ecs_char c) { return ECS_CTYPE(iswlower, islower, c); } -extern bool ecs_isprint(ecs_char c) +extern gboolean ecs_isprint(ecs_char c) { return ECS_CTYPE(iswprint, isprint, c); } -extern bool ecs_ispunct(ecs_char c) +extern gboolean ecs_ispunct(ecs_char c) { return ECS_CTYPE(iswpunct, ispunct, c); } -extern bool ecs_isspace(ecs_char c) +extern gboolean ecs_isspace(ecs_char c) { return ECS_CTYPE(iswspace, isspace, c); } -extern bool ecs_isupper(ecs_char c) +extern gboolean ecs_isupper(ecs_char c) {
updated: [3d0f9e4] Reverted some more GString removals. (See f235b1976ee6dd7aa2be7e75c870784c424e3de3)
The following commit has been merged in the master branch: commit 3d0f9e419a1b8a28196ee15b93adf56eafdd1a1e Author: Patrick Winnertz win...@debian.org Date: Thu Feb 5 23:22:08 2009 +0100 Reverted some more GString removals. (See f235b1976ee6dd7aa2be7e75c870784c424e3de3) Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/edit/edit.c b/edit/edit.c index e853a96..4504df7 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -153,9 +153,10 @@ edit_load_file_fast (WEdit *edit, const char *filename) buf2 = edit-curs2 S_EDIT_BUF_SIZE; if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1) { - char errmsg[8192]; - snprintf(errmsg, sizeof(errmsg), _( Cannot open %s for reading ), filename); - edit_error_dialog (_(Error), get_sys_error (errmsg)); + GString *errmsg = g_string_new(NULL); + g_string_sprintf(errmsg, _( Cannot open %s for reading ), filename); + edit_error_dialog (_(Error), get_sys_error (errmsg-str)); + g_string_free (errmsg, TRUE); return 1; } @@ -315,8 +316,7 @@ static int check_file_access (WEdit *edit, const char *filename, struct stat *st) { int file; -char errmsg[8192]; -errmsg[0] = 0; +GString *errmsg = (GString *) 0; /* Try opening an existing file */ file = mc_open (filename, O_NONBLOCK | O_RDONLY | O_BINARY, 0666); @@ -331,7 +331,8 @@ check_file_access (WEdit *edit, const char *filename, struct stat *st) O_NONBLOCK | O_RDONLY | O_BINARY | O_CREAT | O_EXCL, 0666); if (file 0) { - snprintf (errmsg, sizeof(errmsg), _( Cannot open %s for reading ), filename); + g_string_sprintf (errmsg = g_string_new (NULL), + _( Cannot open %s for reading ), filename); goto cleanup; } else { /* New file, delete it if it's not modified or saved */ @@ -341,13 +342,15 @@ check_file_access (WEdit *edit, const char *filename, struct stat *st) /* Check what we have opened */ if (mc_fstat (file, st) 0) { - snprintf (errmsg, sizeof(errmsg), _( Cannot get size/permissions for %s ), filename); + g_string_sprintf (errmsg = g_string_new (NULL), + _( Cannot get size/permissions for %s ), filename); goto cleanup; } /* We want to open regular files only */ if (!S_ISREG (st-st_mode)) { - snprintf (errmsg, sizeof(errmsg), _( %s is not a regular file ), filename); + g_string_sprintf (errmsg = g_string_new (NULL), + _( %s is not a regular file ), filename); goto cleanup; } @@ -360,14 +363,16 @@ check_file_access (WEdit *edit, const char *filename, struct stat *st) } if (st-st_size = SIZE_LIMIT) { - snprintf (errmsg, sizeof(errmsg), _( File %s is too large ), filename); +g_string_sprintf (errmsg = g_string_new (NULL), + _( File %s is too large ), filename); goto cleanup; } cleanup: (void) mc_close (file); -if (errmsg[0]) { - edit_error_dialog (_(Error), errmsg); +if (errmsg) { + edit_error_dialog (_(Error), errmsg-str); + g_string_free (errmsg, TRUE); return 1; } return 0; diff --git a/edit/editcmd.c b/edit/editcmd.c index 8de68ea..9d730e0 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -1214,16 +1214,14 @@ edit_replace_prompt (WEdit * edit, char *replace_text, int xpos, int ypos) 0, 0, 0, 0, 0}, NULL_QuickWidget}; -const char* label_nls = _( Replace with: ); -char label_text[8192]; -if (*replace_text) -{ - size_t label_len = strlen(label_nls); - snprintf(label_text, sizeof(label_text), %s%s, label_nls, replace_text); - convert_to_display((label_text)+label_len); +GString *label_text = g_string_new (_( Replace with: )); +if (*replace_text) { +size_t label_len; + label_len = label_text-len; +g_string_append (label_text, replace_text); +convert_to_display (label_text-str + label_len); } - -quick_widgets[5].text = label_text; +quick_widgets[5].text = label_text-str; { int retval; @@ -1242,6 +1240,7 @@ edit_replace_prompt (WEdit * edit, char *replace_text, int xpos, int ypos) Quick_input.ypos = ypos; retval = quick_dialog (Quick_input); + g_string_free (label_text, TRUE); return retval; } } diff --git a/edit/syntax.c b/edit/syntax.c index 5de3aaf..479f3c5 100644 --- a/edit/syntax.c +++ b/edit/syntax.c @@ -505,14 +505,10 @@ void edit_get_syntax_color (WEdit * edit, long byte_index, int *color) */ static int read_one_line (char **line, FILE * f) { -char buffer[8192]; -int index = 0, c, r = 0; -buffer[0] = 0; +GString *p = g_string_new (); +int c, r = 0; for (;;) { - if (index = (sizeof(buffer)-1)) - break; - c = fgetc (f); if (c == EOF) { if (ferror (f)) { @@
updated: [e0aba5d] completion: do not complete dead/broken files as dirs
The following commit has been merged in the master branch: commit e0aba5d5885358850186f5b1620f4b96383dce99 Author: Sergei Trofimovich sly...@inbox.ru Date: Sat Feb 7 16:04:36 2009 +0200 completion: do not complete dead/broken files as dirs When we try to complete something what can't be stat()'ed, we treated it like dir. Now we do not consider such candidates for completion. Signed-off-by: Sergei Trofimovich sly...@inbox.ru diff --git a/src/complete.c b/src/complete.c index 4cf71e1..694b602 100644 --- a/src/complete.c +++ b/src/complete.c @@ -155,6 +155,11 @@ filename_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags) isexec = 1; } } + else + { + // stat failed, strange. not a dir in any case + isdir = 0; + } g_free (tmp); } if ((flags INPUT_COMPLETE_COMMANDS) -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [5920d13] First bunch of reverting stuff from mhl to switch back to glib
The following commit has been merged in the master branch: commit 5920d138105dc27eb6f4aec4de7b4d21bd219cdf Author: Patrick Winnertz win...@debian.org Date: Thu Feb 5 23:09:37 2009 +0100 First bunch of reverting stuff from mhl to switch back to glib This removes the usage of stdbool.h in favour of mhl/tyes.h as we have to revert everything one by one Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/ChangeLog b/ChangeLog index e395d88..3fd7ee3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-02-05 Patrick Winnertz win...@debian.org + + * reverted all mhl usage in files except escaping stuff + 2009-02-04 Enrico Weigelt, metux ITS weig...@metux.de * mhl/types.h, mhl/escape.h: replaced bool type by stdbool.h (fixing #239, #240) diff --git a/edit/usermap.c b/edit/usermap.c index 7914d75..b25cad9 100644 --- a/edit/usermap.c +++ b/edit/usermap.c @@ -29,8 +29,8 @@ #include sys/types.h #include sys/stat.h #include unistd.h -#include stdbool.h +#include mhl/types.h #include mhl/memory.h #include mhl/string.h diff --git a/edit/usermap.h b/edit/usermap.h index 29097c4..bf06d12 100644 --- a/edit/usermap.h +++ b/edit/usermap.h @@ -1,7 +1,7 @@ #ifndef MC_USERMAP_H #define MC_USERMAP_H -#include stdbool.h +#include mhl/types.h #define MC_USERMAP .mc/cedit/cooledit.bindings diff --git a/src/ecs-test.c b/src/ecs-test.c index 2493be9..963a63b 100644 --- a/src/ecs-test.c +++ b/src/ecs-test.c @@ -28,7 +28,8 @@ #include assert.h #include locale.h #include stdio.h -#include stdbool.h + +#include mhl/types.h #include global.h #include ecs.h diff --git a/src/ecs.c b/src/ecs.c index cd8da0c..a38c54e 100644 --- a/src/ecs.c +++ b/src/ecs.c @@ -26,8 +26,8 @@ #include assert.h #include ctype.h -#include stdbool.h +#include mhl/types.h #include mhl/string.h #include global.h diff --git a/src/ecs.h b/src/ecs.h index 1a53c6f..98e9a9a 100644 --- a/src/ecs.h +++ b/src/ecs.h @@ -44,7 +44,7 @@ typedef char ecs_char; # define ECS_STR(s) (s) #endif -#include stdbool.h +#include mhl/types.h /* * String conversion functions between the wide character encoding and diff --git a/src/file.c b/src/file.c index ebd414e..1a367ea 100644 --- a/src/file.c +++ b/src/file.c @@ -48,8 +48,8 @@ #include sys/types.h #include sys/stat.h #include unistd.h -#include stdbool.h +#include mhl/types.h #include mhl/memory.h #include mhl/escape.h #include mhl/string.h diff --git a/src/find.c b/src/find.c index 564ed86..bf95b7f 100644 --- a/src/find.c +++ b/src/find.c @@ -26,8 +26,8 @@ #include stdlib.h #include string.h #include sys/stat.h -#include stdbool.h +#include mhl/types.h #include mhl/memory.h #include mhl/string.h diff --git a/src/key.c b/src/key.c index 3bf66de..1434fa7 100644 --- a/src/key.c +++ b/src/key.c @@ -31,8 +31,8 @@ #include string.h #include sys/types.h #include unistd.h -#include stdbool.h +#include mhl/types.h #include mhl/memory.h #include mhl/string.h diff --git a/src/logging.c b/src/logging.c index 60db3e6..a48dcfb 100644 --- a/src/logging.c +++ b/src/logging.c @@ -25,9 +25,9 @@ #include stdarg.h #include stdio.h -#include stdbool.h #include mhl/memory.h +#include mhl/types.h #include global.h #include logging.h diff --git a/src/treestore.c b/src/treestore.c index e8d81ec..cb08cb2 100644 --- a/src/treestore.c +++ b/src/treestore.c @@ -40,8 +40,8 @@ #include sys/types.h #include sys/stat.h #include unistd.h -#include stdbool.h +#include mhl/types.h #include mhl/memory.h #include mhl/string.h diff --git a/src/tty.c b/src/tty.c index 70dbfb6..44b40e5 100644 --- a/src/tty.c +++ b/src/tty.c @@ -28,7 +28,6 @@ #include signal.h #include stdarg.h -#include stdbool.h #include mhl/types.h diff --git a/src/tty.h b/src/tty.h index b7ea928..f6d520b 100644 --- a/src/tty.h +++ b/src/tty.h @@ -25,7 +25,7 @@ #endif /* WANT_TERM_H */ #endif /* USE_NCURSES */ -#include stdbool.h +#include mhl/types.h /* {{{ Input }}} */ diff --git a/src/utilunix.c b/src/utilunix.c index 71f839a..4cf70dc 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -32,7 +32,7 @@ #include stdio.h #include stdlib.h #include string.h -#include stdbool.h + #include sys/param.h #include sys/types.h #include sys/stat.h @@ -41,6 +41,7 @@ #endif #include unistd.h +#include mhl/types.h #include mhl/memory.h #include mhl/string.h diff --git a/src/view.c b/src/view.c index b00916a..dcd3559 100644 --- a/src/view.c +++ b/src/view.c @@ -42,8 +42,8 @@ #include sys/types.h #include sys/stat.h #include unistd.h -#include stdbool.h +#include mhl/types.h #include mhl/memory.h #include mhl/string.h diff --git a/src/widget.c b/src/widget.c index e8f8be3..31afab6 100644 --- a/src/widget.c +++ b/src/widget.c @@ -33,8 +33,8 @@ #include stdio.h #include string.h #include sys/types.h -#include stdbool.h +#include mhl/types.h #include mhl/memory.h #include mhl/string.h diff --git a/src/widget.h
updated: [d8aa8a3] Forgot to remove some more .s strings and do a rename in order to prevent compiler warnings + added include
The following commit has been merged in the master branch: commit d8aa8a302837a84c0ddaf65009b2ce6bc7dcf6dd Author: Patrick Winnertz win...@debian.org Date: Fri Feb 6 00:34:50 2009 +0100 Forgot to remove some more .s strings and do a rename in order to prevent compiler warnings + added include Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/mhl/memory.h b/mhl/memory.h index 3a77934..3268e93 100644 --- a/mhl/memory.h +++ b/mhl/memory.h @@ -11,13 +11,13 @@ #definemhl_mem_alloc_z(sz) (calloc(1,sz)) /* free a chunk of memory from stack, passing NULL does no harm */ -static inline void g_free(void* ptr) +static inline void mhl_mem_free(void* ptr) { if (ptr) free(ptr); } /* free an ptr and NULL it */ -#defineMHL_PTR_FREE(ptr) do { g_free(ptr); (ptr) = NULL; } while (0) +#defineMHL_PTR_FREE(ptr) do { mhl_mem_free(ptr); (ptr) = NULL; } while (0) /* allocate a chunk on stack - automatically free'd on function exit */ #definemhl_stack_alloc(sz) (alloca(sz)) diff --git a/vfs/fish.c b/vfs/fish.c index 397d310..2e59c8b 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -463,7 +463,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) echo '### 500'\n fi\n, quoted_path, quoted_path, quoted_path, quoted_path, quoted_path, quoted_path); -g_free (quoted_path.s); +g_free (quoted_path); ent = vfs_s_generate_entry(me, NULL, dir, 0); while (1) { int res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), SUP.sockr); @@ -735,14 +735,14 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc (unsigned long) s.st_size); } close(h); -g_free(quoted_name.s); +g_free(quoted_name); if ((fish_get_reply (me, SUP.sockr, NULL, 0) != COMPLETE) || was_error) ERRNOR (E_REMOTE, -1); return 0; error_return: close(h); fish_get_reply(me, SUP.sockr, NULL, 0); -g_free(quoted_name.s); +g_free(quoted_name); return -1; } @@ -780,7 +780,7 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset) echo '### 500'\n fi\n, quoted_name, quoted_name, quoted_name, quoted_name ); -g_free (quoted_name.s); +g_free (quoted_name); if (offset != PRELIM) ERRNOR (E_REMOTE, 0); fh-linear = LS_LINEAR_OPEN; fh-u.fish.got = 0; @@ -934,8 +934,8 @@ static int fish_##name (struct vfs_class *me, const char *path1, const char *pat rpath2 = mhl_shell_escape_dup (crpath2); \ g_free (mpath2); \ g_snprintf(buf, sizeof(buf), string \n, rpath1, rpath2, rpath1, rpath2); \ -g_free (rpath1.s); \ -g_free (rpath2.s); \ +g_free (rpath1); \ +g_free (rpath2); \ return fish_send_command(me, super2, buf, OPT_FLUSH); \ } diff --git a/vfs/vfs.c b/vfs/vfs.c index 6995d55..f13d217 100644 --- a/vfs/vfs.c +++ b/vfs/vfs.c @@ -38,6 +38,8 @@ #include signal.h #include ctype.h /* is_digit() */ +#include mhl/string.h + #include ../src/global.h #include ../src/tty.h/* enable/disable interrupt key */ #include ../src/wtools.h /* message() */ -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [96fc77b] fixed canonicalize_pathname() breakage: fixed str_move() function (memmove semantics) again
The following commit has been merged in the master branch: commit 96fc77bc3ee1f2ae2ae7c0a14d3bf08975b4cb66 Author: Sergei Trofimovich sly...@inbox.ru Date: Sat Feb 7 16:10:33 2009 +0200 fixed canonicalize_pathname() breakage: fixed str_move() function (memmove semantics) again This patch reintroduces fix firstly appeared in (and recently broken by mhl revert) commit e48cb7c89ff3e54de70130a3de2136a9902a023d Author: Sergei Trofimovich s...@anti-virus.by Date: Fri Jan 30 09:31:28 2009 +0200 mhl: added mhl_strmove() function (memmove semantics) ... Snippet of man strcpy: DESCRIPTION The strcpy() function copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dest. ___The strings may not overlap___, and the destination string dest must be large enough to receive the copy. We used strcpy to move data chunk in memory: ./foo - foo, etc. This patch introduces mhl_strmove and fixed canonicalize_pathname. Signed-off-by: Sergei Trofimovich sly...@inbox.ru diff --git a/src/util.h b/src/util.h index 1ac88dd..e108424 100644 --- a/src/util.h +++ b/src/util.h @@ -2,7 +2,8 @@ #define MC_UTIL_H #include sys/types.h - +#include assert.h +#include string.h /* Returns its argument as a modifiable string. This function is * intended to pass strings to legacy libraries that don't know yet @@ -263,7 +264,28 @@ char *shell_unescape( const char * ); char *shell_escape( const char * ); #define str_dup_range(s_start, s_bound) (g_strndup(s_start, s_bound - s_start)) -#define str_move(dest, src) (g_strlcpy(dest,src,strlen(src))) + +/* + * strcpy is unsafe on overlapping memory areas, so define memmove-alike + * string function. + * Have sense only when: + * * dest = src + * AND + * * dest and str are pointers to one object (as Roland Illig pointed). + * + * We can't use str*cpy funs here: + * http://kerneltrap.org/mailarchive/openbsd-misc/2008/5/27/1951294 + */ +static inline char * str_move(char * dest, const char * src) +{ +size_t n; + +assert (dest=src); + +n = strlen (src) + 1; /* + '\0' */ + +return memmove (dest, src, n); +} #define MC_PTR_FREE(ptr) do { g_free(ptr); (ptr) = NULL; } while (0) -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [fe95221] Rewrote the shell_escape function in order to make us of GString and g_string_append_c
The following commit has been merged in the master branch: commit fe95221f05e3cc4a80effdcb886768a9eb77efa7 Author: Patrick Winnertz win...@debian.org Date: Fri Feb 6 14:32:09 2009 +0100 Rewrote the shell_escape function in order to make us of GString and g_string_append_c As we decided to fully switch back to glb we needed to rewrite this function in order to use glib functions. This means in this case mostly that *ptr = c; ptr++; is replaced by something like this: g_string_append(str,c); with str a GString*. Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/src/util.c b/src/util.c index 9924f35..96396c0 100644 --- a/src/util.c +++ b/src/util.c @@ -1550,16 +1550,18 @@ Q_ (const char *s) string for escaping \returns - return escaped string (later need to free) + return escaped string (which needs to be freed later) */ char* shell_escape(const char* src) { + GString *str; + char *result = NULL; + if ((src==NULL)||(!(*src))) return strdup(); - char* buffer = calloc(1, strlen(src)*2+2); - char* ptr = buffer; + str = g_string_new(); /* look for the first char to escape */ while (1) @@ -1568,19 +1570,19 @@ shell_escape(const char* src) /* copy over all chars not to escape */ while ((c=(*src)) shell_escape_nottoesc(c)) { - *ptr = c; - ptr++; + g_string_append_c(str,c); src++; } /* at this point we either have an \0 or an char to escape */ - if (!c) - return buffer; + if (!c) { + result = str-str; + g_string_free(str,FALSE); + return result; + } - *ptr = '\\'; - ptr++; - *ptr = c; - ptr++; + g_string_append_c(str,'\\'); + g_string_append_c(str,c); src++; } } -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [589ffd0] Use g_snprintf instead of snprintf as we switch back to glib
The following commit has been merged in the master branch: commit 589ffd0b106b192fc43d1879aa1b7d364297528d Author: Patrick Winnertz win...@debian.org Date: Thu Feb 5 23:49:00 2009 +0100 Use g_snprintf instead of snprintf as we switch back to glib Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/edit/editcmd.c b/edit/editcmd.c index 60bced2..6d3c2ed 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -2316,7 +2316,7 @@ edit_goto_cmd (WEdit *edit) char *error; char s[32]; -snprintf (s, sizeof (s), %ld, line); +g_snprintf (s, sizeof (s), %ld, line); f = input_dialog (_( Goto line ), _( Enter line: ), MC_HISTORY_EDIT_GOTO_LINE, line ? s : ); if (!f) diff --git a/edit/editdraw.c b/edit/editdraw.c index b191391..86ea3f9 100644 --- a/edit/editdraw.c +++ b/edit/editdraw.c @@ -72,7 +72,7 @@ static void status_string (WEdit * edit, char *s, int w) */ if (edit-curs1 edit-last_byte) { unsigned char cur_byte = edit_get_byte (edit, edit-curs1); - snprintf (byte_str, sizeof (byte_str), %c %3d 0x%02X, + g_snprintf (byte_str, sizeof (byte_str), %c %3d 0x%02X, is_printable (cur_byte) ? cur_byte : '.', (int) cur_byte, (unsigned) cur_byte); @@ -81,7 +81,7 @@ static void status_string (WEdit * edit, char *s, int w) } /* The field lengths just prevent the status line from shortening too much */ -snprintf (s, w, +g_snprintf (s, w, [%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb)= %s, edit-mark1 != edit-mark2 ? ( column_highlighting ? 'C' : 'B') : '-', edit-modified ? 'M' : '-', diff --git a/edit/editoptions.c b/edit/editoptions.c index 777431f..9011ded 100644 --- a/edit/editoptions.c +++ b/edit/editoptions.c @@ -147,9 +147,9 @@ edit_options_dialog (void) i18n_flag = 1; } -snprintf (wrap_length, sizeof (wrap_length), %d, +g_snprintf (wrap_length, sizeof (wrap_length), %d, option_word_wrap_line_length); -snprintf (tab_spacing, sizeof (tab_spacing), %d, +g_snprintf (tab_spacing, sizeof (tab_spacing), %d, option_tab_spacing); quick_widgets[3].text = wrap_length; diff --git a/src/boxes.c b/src/boxes.c index a2c863c..a950f3d 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -573,7 +573,7 @@ sel_charset_button (int action) : codepages[new_display_codepage].name; /* avoid strange bug with label repainting */ -snprintf (buf, sizeof (buf), %-27s, cpname); +g_snprintf (buf, sizeof (buf), %-27s, cpname); label_set_text (cplabel, buf); return 0; } @@ -774,12 +774,12 @@ configure_vfs (void) ret_use_netrc = use_netrc; ret_ftpfs_use_passive_connections = ftpfs_use_passive_connections; ret_ftpfs_use_passive_connections_over_proxy = ftpfs_use_passive_connections_over_proxy; -snprintf(buffer3, sizeof (buffer3), %i, ftpfs_directory_timeout); +g_snprintf(buffer3, sizeof (buffer3), %i, ftpfs_directory_timeout); confvfs_widgets[8].text = buffer3; confvfs_widgets[10].text = ftpfs_anonymous_passwd; confvfs_widgets[5].text = ftpfs_proxy_host; #endif -snprintf (buffer2, sizeof (buffer2), %i, vfs_timeout); +g_snprintf (buffer2, sizeof (buffer2), %i, vfs_timeout); confvfs_widgets [3 + VFS_WIDGETBASE].text = buffer2; if (quick_dialog (confvfs_dlg) != B_CANCEL) { diff --git a/src/charsets.c b/src/charsets.c index 4e807c0..f2e69e0 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -198,7 +198,7 @@ init_translation_table (int cpsource, int cpdisplay) cd = iconv_open (cpdisp, cpsour); if (cd == (iconv_t) - 1) { - snprintf (errbuf, sizeof (errbuf), + g_snprintf (errbuf, sizeof (errbuf), _(Cannot translate from %s to %s), cpsour, cpdisp); return errbuf; } @@ -212,7 +212,7 @@ init_translation_table (int cpsource, int cpdisplay) cd = iconv_open (cpsour, cpdisp); if (cd == (iconv_t) - 1) { - snprintf (errbuf, sizeof (errbuf), + g_snprintf (errbuf, sizeof (errbuf), _(Cannot translate from %s to %s), cpdisp, cpsour); return errbuf; } diff --git a/src/chmod.c b/src/chmod.c index 3f76b0c..2671c65 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -161,7 +161,7 @@ chmod_callback (Dlg_head *h, dlg_msg_t msg, int parm) case DLG_ACTION: if (id = 0) { c_stat ^= check_perm[id].mode; - snprintf (buffer, sizeof (buffer), %o, c_stat); + g_snprintf (buffer, sizeof (buffer), %o, c_stat); label_set_text (statl, buffer); chmod_toggle_select (h, id); mode_change = 1; @@ -302,7 +302,7 @@ void chmod_cmd (void) add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown)); c_fgrp = name_trunc (get_group (sf_stat.st_gid), 21); add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp)); -
updated: [3b8f37b] Moved some functions out of mhl into src/util.c
The following commit has been merged in the master branch: commit 3b8f37b99e551eb1db84b8136f828c4165e4be6f Author: Patrick Winnertz win...@debian.org Date: Fri Feb 6 11:17:03 2009 +0100 Moved some functions out of mhl into src/util.c This commit moves the mhl_str_concat_dir_and_file back into src/util.c whitout changing atm the functionality. Please note that this is an incomplete fix and needs to be partially enhanced in order to keep the full functionality with glib. Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/edit/edit.c b/edit/edit.c index e8c0c8e..12f5b72 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -2667,7 +2667,7 @@ user_menu (WEdit * edit) int nomark; struct stat status; long start_mark, end_mark; -char *block_file = mhl_str_dir_plus_file (home_dir, BLOCK_FILE); +char *block_file = concat_dir_and_file (home_dir, BLOCK_FILE); int rc = 0; nomark = eval_marks (edit, start_mark, end_mark); diff --git a/edit/editcmd.c b/edit/editcmd.c index 6d3c2ed..26930c6 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -215,7 +215,7 @@ edit_save_file (WEdit *edit, const char *filename) return 0; if (*filename != PATH_SEP edit-dir) { - savename = mhl_str_dir_plus_file (edit-dir, filename); + savename = concat_dir_and_file (edit-dir, filename); filename = catstrs (savename, (char *) NULL); g_free (savename); } @@ -281,7 +281,7 @@ edit_save_file (WEdit *edit, const char *filename) savedir[slashpos - filename + 1] = '\0'; } else savedir = mhl_str_dup (.); - saveprefix = mhl_str_dir_plus_file (savedir, cooledit); + saveprefix = concat_dir_and_file (savedir, cooledit); g_free (savedir); fd = mc_mkstemps (savename, saveprefix, NULL); g_free (saveprefix); diff --git a/edit/editwidget.c b/edit/editwidget.c index 8fb8c14..89e0a5a 100644 --- a/edit/editwidget.c +++ b/edit/editwidget.c @@ -176,7 +176,7 @@ edit_file (const char *_file, int line) WButtonBar *edit_bar; if (!made_directory) { - char *dir = mhl_str_dir_plus_file (home_dir, EDIT_DIR); + char *dir = concat_dir_and_file (home_dir, EDIT_DIR); made_directory = (mkdir (dir, 0700) != -1 || errno == EEXIST); g_free (dir); } diff --git a/edit/syntax.c b/edit/syntax.c index 8fdea33..427d24e 100644 --- a/edit/syntax.c +++ b/edit/syntax.c @@ -1026,7 +1026,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file, f = fopen (syntax_file, r); if (!f){ - lib_file = mhl_str_dir_plus_file (mc_home, syntax PATH_SEP_STR Syntax); + lib_file = concat_dir_and_file (mc_home, syntax PATH_SEP_STR Syntax); f = fopen (lib_file, r); g_free (lib_file); if (!f) @@ -1187,7 +1187,7 @@ edit_load_syntax (WEdit *edit, char ***pnames, const char *type) if (!*edit-filename !type) return; } -f = mhl_str_dir_plus_file (home_dir, SYNTAX_FILE); +f = concat_dir_and_file (home_dir, SYNTAX_FILE); r = edit_read_syntax_file (edit, pnames, f, edit ? edit-filename : 0, get_first_editor_line (edit), type); if (r == -1) { diff --git a/edit/usermap.c b/edit/usermap.c index e30c011..bb8e0db 100644 --- a/edit/usermap.c +++ b/edit/usermap.c @@ -599,7 +599,7 @@ edit_load_user_map(WEdit *edit) if (edit_key_emulation != EDIT_KEY_EMULATION_USER) return TRUE; -file = mhl_str_dir_plus_file(home_dir, MC_USERMAP); +file = concat_dir_and_file(home_dir, MC_USERMAP); if (stat(file, s) 0) { char *msg = g_strdup_printf(_(%s not found!), file); diff --git a/src/charsets.c b/src/charsets.c index f2e69e0..10bbefc 100644 --- a/src/charsets.c +++ b/src/charsets.c @@ -50,7 +50,7 @@ load_codepages_list (void) extern int display_codepage; char *default_codepage = NULL; -fname = mhl_str_dir_plus_file (mc_home, CHARSETS_INDEX); +fname = concat_dir_and_file (mc_home, CHARSETS_INDEX); if (!(f = fopen (fname, r))) { fprintf (stderr, _(Warning: file %s not found\n), fname); g_free (fname); diff --git a/src/cmd.c b/src/cmd.c index 0bab86e..048037d 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -374,7 +374,7 @@ mkdir_cmd (void) if (dir[0] == '/' || dir[0] == '~') absdir = g_strdup (dir); else - absdir = mhl_str_dir_plus_file (current_panel-cwd, dir); + absdir = concat_dir_and_file (current_panel-cwd, dir); save_cwds_stat (); if (my_mkdir (absdir, 0777) == 0) { @@ -580,10 +580,10 @@ void ext_cmd (void) _( Which extension file you want to edit? ), D_NORMAL, 2, _(User), _(System Wide)); } -extdir = mhl_str_dir_plus_file (mc_home, MC_LIB_EXT); +extdir = concat_dir_and_file (mc_home, MC_LIB_EXT); if (dir == 0){ - buffer = mhl_str_dir_plus_file (home_dir,
updated: [8bd8830] Removed TODO Marker in util.c as the functions are fully ported to use glib now
The following commit has been merged in the master branch: commit 8bd883085fe3f749d0a533cd9233c389d49f0234 Author: Patrick Winnertz win...@debian.org Date: Fri Feb 6 15:01:34 2009 +0100 Removed TODO Marker in util.c as the functions are fully ported to use glib now Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/src/util.c b/src/util.c index 2046f10..cee81e8 100644 --- a/src/util.c +++ b/src/util.c @@ -1531,8 +1531,6 @@ Q_ (const char *s) return (sep != NULL) ? sep + 1 : result; } -/*TODO: These three functions should use glib and should be fixed soon */ - #define shell_escape_toesc(x) \ (((x)==' ')||((x)=='!')||((x)=='#')||((x)=='$')||((x)=='%')|| \ ((x)=='(')||((x)==')')||((x)=='\'')||((x)=='')||((x)=='~')|| \ -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [97bdf08] shell_unescape: fix recently added breakage of decoding escapy strings
The following commit has been merged in the master branch: commit 97bdf084f8d655ae03879fa0a6492b00930f17f6 Author: Sergei Trofimovich sly...@inbox.ru Date: Sat Feb 7 16:15:41 2009 +0200 shell_unescape: fix recently added breakage of decoding escapy strings This pach fixes two issues (both appear only in escapy strings): * tail cut of escapy string when '\\' is met * head cut of escapy string when '\\' is met :] Signed-off-by: Sergei Trofimovich sly...@inbox.ru diff --git a/src/util.c b/src/util.c index cee81e8..e47b6dc 100644 --- a/src/util.c +++ b/src/util.c @@ -1611,7 +1611,7 @@ shell_unescape(const char* text) result = g_strdup(text); return result; } - str = g_string_new(); + str = g_string_new_len(text, readptr - text); /* if we're here, we're standing on the first '\' */ char c; @@ -1622,6 +1622,9 @@ shell_unescape(const char* text) readptr++; switch ((c = *readptr)) { + case '\0': /* end of string! malformed escape string */ + goto out; + case 'n': g_string_append_c(str,'\n'); break; case 'r': g_string_append_c(str,'\r'); break; case 't': g_string_append_c(str,'\t'); break; @@ -1646,8 +1649,6 @@ shell_unescape(const char* text) case '`': case '': case ';': - case '\0': /* end of string! malformed escape string */ - goto out; default: g_string_append_c(str,c); break; } @@ -1659,7 +1660,6 @@ shell_unescape(const char* text) readptr++; } out: - g_string_append_c(str,'\0'); result = str-str; g_string_free(str,FALSE); -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [e54f318] Completely removed MHL stuff
The following commit has been merged in the master branch: commit e54f318cef911eab70753583be922c9ec35d531d Author: Slava Zanko slavaza...@gmail.com Date: Fri Feb 6 14:01:28 2009 +0200 Completely removed MHL stuff Changed all source files relative to remove MHL Some string-related functions moved into src/util.c This stable fix. diff --git a/edit/choosesyntax.c b/edit/choosesyntax.c index f4137e3..78a7718 100644 --- a/edit/choosesyntax.c +++ b/edit/choosesyntax.c @@ -18,9 +18,6 @@ #include config.h -#include mhl/memory.h -#include mhl/string.h - #include edit.h #include ../src/global.h #include ../src/wtools.h diff --git a/edit/edit.c b/edit/edit.c index 12f5b72..3697bb5 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -32,9 +32,6 @@ #include sys/stat.h #include stdlib.h -#include mhl/memory.h -#include mhl/string.h - #include ../src/global.h #include edit.h diff --git a/edit/editcmd.c b/edit/editcmd.c index 26930c6..257ab6e 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -38,9 +38,6 @@ #include sys/stat.h #include stdlib.h -#include mhl/memory.h -#include mhl/string.h - #include ../src/global.h #include ../src/history.h @@ -277,10 +274,10 @@ edit_save_file (WEdit *edit, const char *filename) const char *slashpos; slashpos = strrchr (filename, PATH_SEP); if (slashpos) { - savedir = mhl_str_dup (filename); + savedir = g_strdup (filename); savedir[slashpos - filename + 1] = '\0'; } else - savedir = mhl_str_dup (.); + savedir = g_strdup (.); saveprefix = concat_dir_and_file (savedir, cooledit); g_free (savedir); fd = mc_mkstemps (savename, saveprefix, NULL); @@ -1850,9 +1847,9 @@ edit_replace_cmd (WEdit *edit, int again) goto cleanup; } - g_free (saved1), saved1 = mhl_str_dup (input1); - g_free (saved2), saved2 = mhl_str_dup (input2); - g_free (saved3), saved3 = mhl_str_dup (input3); + g_free (saved1), saved1 = g_strdup (input1); + g_free (saved2), saved2 = g_strdup (input2); + g_free (saved3), saved3 = g_strdup (input3); } { diff --git a/edit/editlock.c b/edit/editlock.c index a33b1d6..c9434a2 100644 --- a/edit/editlock.c +++ b/edit/editlock.c @@ -36,9 +36,6 @@ #include sys/stat.h #include stdlib.h -#include mhl/memory.h -#include mhl/string.h - #include ../src/global.h #include edit.h diff --git a/edit/editwidget.c b/edit/editwidget.c index 89e0a5a..e23f097 100644 --- a/edit/editwidget.c +++ b/edit/editwidget.c @@ -35,9 +35,6 @@ #include sys/stat.h #include stdlib.h -#include mhl/memory.h -#include mhl/string.h - #include ../src/global.h #include edit.h diff --git a/edit/syntax.c b/edit/syntax.c index 427d24e..b517b4a 100644 --- a/edit/syntax.c +++ b/edit/syntax.c @@ -32,9 +32,6 @@ #include sys/stat.h #include stdlib.h -#include mhl/memory.h -#include mhl/string.h - #include ../src/global.h #include edit.h @@ -471,7 +468,7 @@ static struct syntax_rule edit_get_rule (WEdit * edit, long byte_index) break; } s = edit-syntax_marker-next; - MHL_PTR_FREE (edit-syntax_marker); + MC_PTR_FREE (edit-syntax_marker); edit-syntax_marker = s; } } @@ -666,8 +663,8 @@ static FILE *open_include_file (const char *filename) { FILE *f; -MHL_PTR_FREE (error_file_name); -error_file_name = mhl_str_dup (filename); +MC_PTR_FREE (error_file_name); +error_file_name = g_strdup (filename); if (*filename == PATH_SEP) return fopen (filename, r); @@ -725,8 +722,8 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size) f = g; g = 0; line = save_line + 1; - MHL_PTR_FREE (error_file_name); - MHL_PTR_FREE (l); + MC_PTR_FREE (error_file_name); + MC_PTR_FREE (l); if (!read_one_line (l, f)) break; } else { @@ -745,7 +742,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size) g = f; f = open_include_file (args[1]); if (!f) { - MHL_PTR_FREE (error_file_name); + MC_PTR_FREE (error_file_name); result = line; break; } @@ -922,10 +919,10 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size) break_a; } free_args (args); - MHL_PTR_FREE (l); + MC_PTR_FREE (l); } free_args (args); -MHL_PTR_FREE (l); +MC_PTR_FREE (l); /* Terminate context array. */ if (num_contexts 0) { @@ -934,7 +931,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size) } if (!edit-rules[0]) - MHL_PTR_FREE (edit-rules); + MC_PTR_FREE (edit-rules); if
updated: [c26e289] panel: fixed crash when rename/copy (introduced by revert of mhl_strmove)
The following commit has been merged in the master branch: commit c26e289b9f0a27bde985180aaa749cbcdfd3db2f Author: Sergei Trofimovich sly...@inbox.ru Date: Sat Feb 7 16:20:03 2009 +0200 panel: fixed crash when rename/copy (introduced by revert of mhl_strmove) g_strconcat expects 0 as last argument, but mhl_strmove is not. When reverting this detail was overlooked. Returning 0 as last argument. Signed-off-by: Sergei Trofimovich sly...@inbox.ru diff --git a/src/file.c b/src/file.c index 81de8da..9e0e8c2 100644 --- a/src/file.c +++ b/src/file.c @@ -1805,7 +1805,7 @@ panel_operate (void *source_panel, FileOperation operation, else /* add trailing separator */ if (*dest_dir strcmp(dest_dir[strlen(dest_dir)-1], PATH_SEP_STR)) { - dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR); + dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR, (char*)0); } else { dest_dir_ = g_strdup (dest_dir); } -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
updated: [8a55cb1] Removed three more includes of mhl files in smbfs.c
The following commit has been merged in the master branch: commit 8a55cb1e9af2d632555fade4a745617f5a10d956 Author: Patrick Winnertz win...@debian.org Date: Sun Feb 8 12:41:44 2009 +0100 Removed three more includes of mhl files in smbfs.c Signed-off-by: Patrick Winnertz win...@debian.org diff --git a/vfs/smbfs.c b/vfs/smbfs.c index 2001a7d..2f15ebf 100644 --- a/vfs/smbfs.c +++ b/vfs/smbfs.c @@ -26,9 +26,6 @@ #include stdio.h #include sys/types.h -#include mhl/types.h -#include mhl/string.h - #undef USE_NCURSES /* Don't include *curses.h */ #include ../src/global.h #include ../src/tty.h/* enable/disable interrupt key */ @@ -53,8 +50,6 @@ #include string.h -#include mhl/string.h - #include vfs.h #include vfs-impl.h #include smbfs.h -- Midnight Commander Development ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [Midnight Commander] #269: Revert from mhl to Glib
#269: Revert from mhl to Glib ---+ Reporter: Patrick Winnertz win...@debian.org | Owner: winnie Type: defect| Status: accepted Priority: major | Milestone: 4.7 Component: mc-core | Version: 4.6.2 Resolution:|Keywords: vote-angel_il Blocking:| Blockedby: ---+ Changes (by angel_il): * keywords: review vote-slyfox vote-andrew_b vote-winnie vote-miguel vote-slavazanko = vote-angel_il Comment: it's work -- Ticket URL: www.midnight-commander.org/ticket/269#comment:12 Midnight Commander www.midnight-commander.org Midnight Development Center ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [Midnight Commander] #269: Revert from mhl to Glib
#269: Revert from mhl to Glib ---+ Reporter: Patrick Winnertz win...@debian.org | Owner: winnie Type: defect| Status: accepted Priority: major | Milestone: 4.7 Component: mc-core | Version: 4.6.2 Resolution:|Keywords: vote-angel_il vote-slyfox vote-andrew_b vote-winnie vote-miguel vote-slavazanko Blocking:| Blockedby: ---+ Changes (by angel_il): * keywords: vote-angel_il = vote-angel_il vote-slyfox vote-andrew_b vote-winnie vote-miguel vote-slavazanko -- Ticket URL: www.midnight-commander.org/ticket/269#comment:13 Midnight Commander www.midnight-commander.org Midnight Development Center ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [Midnight Commander] #268: [PATCH] Allow using SI-based size prefixes
#268: [PATCH] Allow using SI-based size prefixes --+- Reporter: bilbo| Owner: bilbo Type: enhancement | Status: accepted Priority: major| Milestone: 4.7 Component: mc-core | Version: 4.6.2 Resolution: |Keywords: rework Blocking: | Blockedby: --+- Comment(by slyfox): What do you mean by 'nongettextized M and K duplication' ? Ideally, {, k, m, g, t, p, e, z, y, NULL}; could be internationalized via gettext (in far future :]) and this looks like identifier duplication: xtra = kilobyte_si?k:K; ... xtra = kilobyte_si?m:M; can be changed to suffix[1,2]/suffix_ic[1,2] (with little code restructurements: move suffix* definitions upper). But will it be more readable? Tried to apply patch and didn't find this config option in menus. Is it intended for use in '~/.mc/ini' file only? -- Ticket URL: www.midnight-commander.org/ticket/268#comment:5 Midnight Commander www.midnight-commander.org Midnight Development Center ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [Midnight Commander] #269: Revert from mhl to Glib
#269: Revert from mhl to Glib ---+ Reporter: Patrick Winnertz win...@debian.org | Owner: winnie Type: defect| Status: accepted Priority: major | Milestone: 4.7 Component: mc-core | Version: 4.6.2 Resolution:|Keywords: vote-angel_il vote-slyfox vote-andrew_b vote-winnie vote-miguel vote-slavazanko vote-styx approved Blocking:| Blockedby: ---+ Changes (by styx): * keywords: vote-angel_il vote-slyfox vote-andrew_b vote-winnie vote- miguel vote-slavazanko = vote-angel_il vote- slyfox vote-andrew_b vote-winnie vote-miguel vote-slavazanko vote-styx approved -- Ticket URL: www.midnight-commander.org/ticket/269#comment:14 Midnight Commander www.midnight-commander.org Midnight Development Center ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: updated: [ae987b9] Reverted the use of bool in favour of gboolean
On Tue, Feb 10, 2009 at 12:49:55PM +0100, Patrick Winnertz wrote: +++ b/edit/usermap.c @@ -59,7 +59,7 @@ typedef struct Config { typedef struct Command { const char *name; -bool (*handler) (config_t *cfg, int argc, char *argv[]); +int (*handler) (config_t *cfg, int argc, char *argv[]); shouldn't that be gboolean? i mean, reverting for the revert's sake isn't the goal ... ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: updated: [fe95221] Rewrote the shell_escape function in order to make us of GString and g_string_append_c
On Tue, Feb 10, 2009 at 12:49:57PM +0100, Patrick Winnertz wrote: Rewrote the shell_escape function in order to make us of GString and g_string_append_c glib has functions for shell (un-)escaping. did you look at those? ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: updated: [fe95221] Rewrote the shell_escape function in order to make us of GString and g_string_append_c
2009/2/10 Oswald Buddenhagen o...@kde.org On Tue, Feb 10, 2009 at 12:49:57PM +0100, Patrick Winnertz wrote: Rewrote the shell_escape function in order to make us of GString and g_string_append_c glib has functions for shell (un-)escaping. did you look at those? ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel Yes, we have a look at the escape function from Glib, but it doesn't do all the work we need in. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: updated: [fe95221] Rewrote the shell_escape function in order to make us of GString and g_string_append_c
Am Dienstag 10 Februar 2009 13:38:26 schrieb Oswald Buddenhagen: On Tue, Feb 10, 2009 at 12:49:57PM +0100, Patrick Winnertz wrote: Rewrote the shell_escape function in order to make us of GString and g_string_append_c glib has functions for shell (un-)escaping. did you look at those? Yepp.. indeed. But these functions don't have all the features we needed. Thanks however for your hint. Greetings Winnie -- . '' ` . Patrick Winnertz win...@debian.org : :' : proud Debian developer, author, administrator, and user `. `'` http://people.debian.org/~winnie - http://www.der-winnie.de `- Debian - when you have better things to do than fixing systems signature.asc Description: This is a digitally signed message part. ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: updated: [1c287d7] First bunch of mhl_mem_free removal patches
On Tuesday 2009-02-10 12:49, Patrick Winnertz wrote: @@ -40,7 +40,7 @@ 2009-01-30 Enrico Weigelt, metux ITS weig...@metux.de - * replaced calls to g_free() by mhl_mem_free() + * replaced calls to g_free() by g_free() 2009-01-29 Mikhail S. Pobolovets styx...@gmail.com I spot an invasion of busy beavers. :-) ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [Midnight Commander] #269: Revert from mhl to Glib
#269: Revert from mhl to Glib ---+ Reporter: Patrick Winnertz win...@debian.org | Owner: winnie Type: defect| Status: testing Priority: major | Milestone: 4.7 Component: mc-core | Version: 4.6.2 Resolution: fixed |Keywords: vote-angel_il vote-slyfox vote-andrew_b vote-winnie vote-miguel vote-slavazanko vote-styx approved Blocking:| Blockedby: ---+ Changes (by styx): * status: accepted = testing * resolution: = fixed -- Ticket URL: www.midnight-commander.org/ticket/269#comment:15 Midnight Commander www.midnight-commander.org Midnight Development Center ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel