mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Revert some functions (mhl_mem_free to g_free, etc)
Signed-off-by: Patrick Winnertz <winnie@debian.org>
This commit is contained in:
parent
e4e135399f
commit
f237a14635
@ -63,7 +63,7 @@ examine_cd (char *path)
|
||||
const char *t;
|
||||
|
||||
/* Tilde expansion */
|
||||
path = mhl_shell_unescape_buf(path);
|
||||
path = shell_unescape(path);
|
||||
path_tilde = tilde_expand (path);
|
||||
|
||||
/* Leave space for further expansion */
|
||||
@ -135,7 +135,7 @@ examine_cd (char *path)
|
||||
}
|
||||
g_free (q);
|
||||
g_free (path_tilde);
|
||||
// mhl_mem_free(path);
|
||||
// g_free(path);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ filename_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
|
||||
SHOW_C_CTX("filename_completion_function");
|
||||
|
||||
if (text && (flags & INPUT_COMPLETE_SHELL_ESC))
|
||||
text = mhl_shell_unescape_buf (text);
|
||||
text = shell_unescape (text);
|
||||
|
||||
/* If we're starting the match process, initialize us a bit. */
|
||||
if (!state){
|
||||
@ -203,8 +203,8 @@ 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);
|
||||
mhl_mem_free (temp);
|
||||
SHELL_ESCAPED_STR e_temp = shell_escape(temp);
|
||||
g_free (temp);
|
||||
temp = e_temp.s;
|
||||
}
|
||||
return temp;
|
||||
@ -460,7 +460,7 @@ command_completion_function (char *text, int state, INPUT_COMPLETE_FLAGS flags)
|
||||
if (!(flags & INPUT_COMPLETE_COMMANDS))
|
||||
return 0;
|
||||
|
||||
text = mhl_shell_unescape_buf(text);
|
||||
text = shell_unescape(text);
|
||||
flags &= ~INPUT_COMPLETE_SHELL_ESC;
|
||||
|
||||
if (!state) { /* Initialize us a little bit */
|
||||
@ -483,8 +483,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);
|
||||
mhl_mem_free(p);
|
||||
SHELL_ESCAPED_STR e_p = shell_escape(p);
|
||||
g_free(p);
|
||||
return e_p.s;
|
||||
}
|
||||
|
||||
@ -541,8 +541,8 @@ 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);
|
||||
mhl_mem_free(found);
|
||||
SHELL_ESCAPED_STR e_p = shell_escape(p);
|
||||
g_free(found);
|
||||
return e_p.s;
|
||||
}
|
||||
return found;
|
||||
|
@ -1809,7 +1809,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_ = mhl_str_concat (dest_dir, PATH_SEP_STR);
|
||||
dest_dir_ = g_concat (dest_dir, PATH_SEP_STR);
|
||||
} else {
|
||||
dest_dir_ = mhl_str_dup (dest_dir);
|
||||
}
|
||||
@ -1821,7 +1821,7 @@ panel_operate (void *source_panel, FileOperation operation,
|
||||
dest =
|
||||
file_mask_dialog (ctx, operation, cmd_buf, dest_dir_,
|
||||
single_entry, &do_bg);
|
||||
mhl_mem_free(dest_dir_);
|
||||
g_free(dest_dir_);
|
||||
|
||||
if (!dest) {
|
||||
file_op_context_destroy (ctx);
|
||||
@ -1997,8 +1997,8 @@ panel_operate (void *source_panel, FileOperation operation,
|
||||
else {
|
||||
char *temp2 = concat_dir_and_file (dest, temp);
|
||||
|
||||
source_with_path = mhl_shell_unescape_buf(source_with_path);
|
||||
temp2 = mhl_shell_unescape_buf(temp2);
|
||||
source_with_path = shell_unescape(source_with_path);
|
||||
temp2 = shell_unescape(temp2);
|
||||
|
||||
switch (operation) {
|
||||
case OP_COPY:
|
||||
|
80
vfs/fish.c
80
vfs/fish.c
@ -144,7 +144,7 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super,
|
||||
enable_interrupt_key ();
|
||||
|
||||
status = write (SUP.sockw, str, strlen (str));
|
||||
mhl_mem_free (str);
|
||||
g_free (str);
|
||||
|
||||
disable_interrupt_key ();
|
||||
if (status < 0)
|
||||
@ -168,10 +168,10 @@ fish_free_archive (struct vfs_class *me, struct vfs_s_super *super)
|
||||
close (SUP.sockr);
|
||||
SUP.sockw = SUP.sockr = -1;
|
||||
}
|
||||
mhl_mem_free (SUP.host);
|
||||
mhl_mem_free (SUP.user);
|
||||
mhl_mem_free (SUP.cwdir);
|
||||
mhl_mem_free (SUP.password);
|
||||
g_free (SUP.host);
|
||||
g_free (SUP.user);
|
||||
g_free (SUP.cwdir);
|
||||
g_free (SUP.password);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -251,7 +251,7 @@ fish_open_archive_int (struct vfs_class *me, struct vfs_s_super *super)
|
||||
p = g_strconcat (_(" fish: Password required for "),
|
||||
SUP.user, " ", (char *) NULL);
|
||||
op = vfs_get_password (p);
|
||||
mhl_mem_free (p);
|
||||
g_free (p);
|
||||
if (op == NULL)
|
||||
ERRNOR (EPERM, -1);
|
||||
SUP.password = op;
|
||||
@ -314,7 +314,7 @@ fish_open_archive (struct vfs_class *me, struct vfs_s_super *super,
|
||||
p = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags,
|
||||
&password, 0, URL_NOSLASH);
|
||||
|
||||
mhl_mem_free (p);
|
||||
g_free (p);
|
||||
|
||||
SUP.host = host;
|
||||
SUP.user = user;
|
||||
@ -341,12 +341,12 @@ fish_archive_same (struct vfs_class *me, struct vfs_s_super *super,
|
||||
op = vfs_split_url (strchr (op, ':') + 1, &host, &user, &flags, 0, 0,
|
||||
URL_NOSLASH);
|
||||
|
||||
mhl_mem_free (op);
|
||||
g_free (op);
|
||||
|
||||
flags = ((strcmp (host, SUP.host) == 0)
|
||||
&& (strcmp (user, SUP.user) == 0) && (flags == SUP.flags));
|
||||
mhl_mem_free (host);
|
||||
mhl_mem_free (user);
|
||||
g_free (host);
|
||||
g_free (user);
|
||||
|
||||
return flags;
|
||||
}
|
||||
@ -377,7 +377,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
|
||||
gettimeofday(&dir->timestamp, NULL);
|
||||
dir->timestamp.tv_sec += fish_directory_timeout;
|
||||
quoted_path = mhl_shell_escape_dup (remote_path);
|
||||
quoted_path = shell_escape (remote_path);
|
||||
fish_command (me, super, NONE,
|
||||
"#LIST /%s\n"
|
||||
"if `perl -v > /dev/null 2>&1` ; then\n"
|
||||
@ -454,7 +454,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
"echo '### 500'\n"
|
||||
"fi\n",
|
||||
quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s, quoted_path.s);
|
||||
mhl_mem_free (quoted_path.s);
|
||||
g_free (quoted_path.s);
|
||||
ent = vfs_s_generate_entry(me, NULL, dir, 0);
|
||||
while (1) {
|
||||
int res = vfs_s_get_line_interruptible (me, buffer, sizeof (buffer), SUP.sockr);
|
||||
@ -515,11 +515,11 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
--linkname_bound; // skip trailing "
|
||||
}
|
||||
|
||||
ent->name = mhl_str_dup_range(filename, filename_bound);
|
||||
mhl_shell_unescape_buf(ent->name);
|
||||
ent->name = str_dup_range(filename, filename_bound);
|
||||
shell_unescape(ent->name);
|
||||
|
||||
ent->ino->linkname = mhl_str_dup_range(linkname, linkname_bound);
|
||||
mhl_shell_unescape_buf(ent->ino->linkname);
|
||||
ent->ino->linkname = str_dup_range(linkname, linkname_bound);
|
||||
shell_unescape(ent->ino->linkname);
|
||||
} else {
|
||||
// we expect: "escaped-name"
|
||||
if (filename_bound - filename > 2)
|
||||
@ -532,8 +532,8 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
--filename_bound;
|
||||
}
|
||||
|
||||
ent->name = mhl_str_dup_range(filename, filename_bound);
|
||||
mhl_shell_unescape_buf(ent->name);
|
||||
ent->name = str_dup_range(filename, filename_bound);
|
||||
shell_unescape(ent->name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -585,7 +585,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
vfs_s_free_entry (me, ent);
|
||||
reply_code = fish_decode_reply(buffer + 4, 0);
|
||||
if (reply_code == COMPLETE) {
|
||||
mhl_mem_free (SUP.cwdir);
|
||||
g_free (SUP.cwdir);
|
||||
SUP.cwdir = g_strdup (remote_path);
|
||||
print_vfs_message (_("%s: done."), me->name);
|
||||
return 0;
|
||||
@ -649,7 +649,7 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
|
||||
* algorithm for file appending case, therefore just "dd" is used for it.
|
||||
*/
|
||||
|
||||
quoted_name = mhl_shell_escape_dup(name);
|
||||
quoted_name = shell_escape(name);
|
||||
print_vfs_message(_("fish: store %s: sending command..."), quoted_name.s );
|
||||
|
||||
/* FIXME: File size is limited to ULONG_MAX */
|
||||
@ -726,14 +726,14 @@ fish_file_store(struct vfs_class *me, struct vfs_s_fh *fh, char *name, char *loc
|
||||
(unsigned long) s.st_size);
|
||||
}
|
||||
close(h);
|
||||
mhl_mem_free(quoted_name.s);
|
||||
g_free(quoted_name.s);
|
||||
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);
|
||||
mhl_mem_free(quoted_name.s);
|
||||
g_free(quoted_name.s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -747,7 +747,7 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
|
||||
name = vfs_s_fullpath (me, fh->ino);
|
||||
if (!name)
|
||||
return 0;
|
||||
quoted_name = mhl_shell_escape_dup(name);
|
||||
quoted_name = shell_escape(name);
|
||||
fh->u.fish.append = 0;
|
||||
|
||||
/*
|
||||
@ -771,7 +771,7 @@ fish_linear_start (struct vfs_class *me, struct vfs_s_fh *fh, off_t offset)
|
||||
"echo '### 500'\n"
|
||||
"fi\n",
|
||||
quoted_name.s, quoted_name.s, quoted_name.s, quoted_name.s );
|
||||
mhl_mem_free (quoted_name.s);
|
||||
g_free (quoted_name.s);
|
||||
if (offset != PRELIM) ERRNOR (E_REMOTE, 0);
|
||||
fh->linear = LS_LINEAR_OPEN;
|
||||
fh->u.fish.got = 0;
|
||||
@ -884,14 +884,14 @@ fish_send_command(struct vfs_class *me, struct vfs_s_super *super, const char *c
|
||||
SHELL_ESCAPED_STR rpath; \
|
||||
struct vfs_s_super *super; \
|
||||
if (!(crpath = vfs_s_get_path_mangle (me, mpath, &super, 0))) { \
|
||||
mhl_mem_free (mpath); \
|
||||
g_free (mpath); \
|
||||
return -1; \
|
||||
} \
|
||||
rpath = mhl_shell_escape_dup(crpath); \
|
||||
mhl_mem_free (mpath);
|
||||
rpath = shell_escape(crpath); \
|
||||
g_free (mpath);
|
||||
|
||||
#define POSTFIX(flags) \
|
||||
mhl_mem_free (rpath.s); \
|
||||
g_free (rpath.s); \
|
||||
return fish_send_command(me, super, buf, flags);
|
||||
|
||||
static int
|
||||
@ -914,21 +914,21 @@ static int fish_##name (struct vfs_class *me, const char *path1, const char *pat
|
||||
char *mpath1, *mpath2; \
|
||||
struct vfs_s_super *super1, *super2; \
|
||||
if (!(crpath1 = vfs_s_get_path_mangle (me, mpath1 = g_strdup(path1), &super1, 0))) { \
|
||||
mhl_mem_free (mpath1); \
|
||||
g_free (mpath1); \
|
||||
return -1; \
|
||||
} \
|
||||
if (!(crpath2 = vfs_s_get_path_mangle (me, mpath2 = g_strdup(path2), &super2, 0))) { \
|
||||
mhl_mem_free (mpath1); \
|
||||
mhl_mem_free (mpath2); \
|
||||
g_free (mpath1); \
|
||||
g_free (mpath2); \
|
||||
return -1; \
|
||||
} \
|
||||
SHELL_ESCAPED_STR rpath1 = mhl_shell_escape_dup (crpath1); \
|
||||
mhl_mem_free (mpath1); \
|
||||
SHELL_ESCAPED_STR rpath2 = mhl_shell_escape_dup (crpath2); \
|
||||
mhl_mem_free (mpath2); \
|
||||
SHELL_ESCAPED_STR rpath1 = shell_escape (crpath1); \
|
||||
g_free (mpath1); \
|
||||
SHELL_ESCAPED_STR rpath2 = shell_escape (crpath2); \
|
||||
g_free (mpath2); \
|
||||
g_snprintf(buf, sizeof(buf), string "\n", rpath1.s, rpath2.s, rpath1.s, rpath2.s); \
|
||||
mhl_mem_free (rpath1.s); \
|
||||
mhl_mem_free (rpath2.s); \
|
||||
g_free (rpath1.s); \
|
||||
g_free (rpath2.s); \
|
||||
return fish_send_command(me, super2, buf, OPT_FLUSH); \
|
||||
}
|
||||
|
||||
@ -943,13 +943,13 @@ static int fish_symlink (struct vfs_class *me, const char *setto, const char *pa
|
||||
{
|
||||
SHELL_ESCAPED_STR qsetto;
|
||||
PREFIX
|
||||
qsetto = mhl_shell_escape_dup (setto);
|
||||
qsetto = shell_escape (setto);
|
||||
g_snprintf(buf, sizeof(buf),
|
||||
"#SYMLINK %s /%s\n"
|
||||
"ln -s %s /%s 2>/dev/null\n"
|
||||
"echo '### 000'\n",
|
||||
qsetto.s, rpath.s, qsetto.s, rpath.s);
|
||||
mhl_mem_free (qsetto.s);
|
||||
g_free (qsetto.s);
|
||||
POSTFIX(OPT_FLUSH);
|
||||
}
|
||||
|
||||
@ -1079,7 +1079,7 @@ fish_fill_names (struct vfs_class *me, fill_names_f func)
|
||||
name = g_strconcat ("/#sh:", SUP.user, "@", SUP.host, flags,
|
||||
"/", SUP.cwdir, (char *) NULL);
|
||||
(*func)(name);
|
||||
mhl_mem_free (name);
|
||||
g_free (name);
|
||||
super = super->next;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user