Re: [Midnight Commander] #147: Fix escaping for completion on cmdline (spaces, backslashes, etc).
- From: "Ticket System" <tickets midnight-commander org>
- To: winnie debian org
- Cc: mc-devel gnome org
- Subject: Re: [Midnight Commander] #147: Fix escaping for completion on cmdline (spaces, backslashes, etc).
- Date: Tue, 06 Jan 2009 22:56:30 -0000
#147: Fix escaping for completion on cmdline (spaces, backslashes, etc).
---------------------------------------------------+------------------------
Reporter: Patrick Winnertz <winnie debian org> | Owner: winnie
Type: defect | Status: accepted
Priority: major | Milestone: 4.6.2
Component: mc-core | Version: 4.6.1
Resolution: | Keywords: review
Blocking: 149 | Blockedby:
---------------------------------------------------+------------------------
Comment(by Patrick Winnertz):
Hey Roland,
See the branch this commit belongs too, and you'll see that this belongs
to a
patch where some rework is needed. :) See ticket:147.
In order to get your remark not only onto this list but also into the
ticket
'm replying not the the list but to the ticketsystem which will then
forward
the mail back to the list.
> I don't get why there has to be a variable k in the functions. Its
> completely unnecessary. A much simpler, faster, and more reliable way is
> the following (untested):
I'll test it and merge it into the bugfix branch.
>
> char *
> unescape_string(const char *in) {
> GString *str;
> const char * src;
> char *result;
>
> str = g_string_new("");
>
> for (src = in; *src != '\0'; src++) {
> if (src[0] == '\\' && strchr(" \t*|;<>~#()?[]{}&", src[1])) {
> g_string_append_c(str, src[1]);
> src++;
> } else {
> g_string_append_c(str, src[0]);
> }
> }
>
> result = str->str;
> g_string_free(str, FALSE);
> return result;
> }
>
> It's much simpler that way. It doesn't call strlen() unnecessarily. It
> doesn't have unneeded variables. And it doesn't crash if in[-1] is an
> illegal address.
Well It is indeed much simpler.. but do you tested this patch once? mc
won't
crash...(tested).
Greetings
Winnie
--
Ticket URL: <www.midnight-commander.org/ticket/147#comment:>
Midnight Commander <www.midnight-commander.org>
Midnight Development Center
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]