On 2013/09/05 21:01, Maarten de Vries <maar...@de-vri.es> wrote:
> While patching this in, I also noticed that tilde paths weren't properly
> parsed in the latest git version. For example: `~/.mpd/database' became
> `/home/maarten/~/.mpd/database'. I also fixed that by mostly replacing the
> old function. The version in my patch uses std::string and iterators rather
> than old C strings and C functions. It's C++ now after all and I found it
> much easier that way.

This patch looks VERY confusing because you mixed two different things
in one patch.  One is the rewrite, the other is the bug fix.

I don't even see an advantage of using std::string here (the
disadvantage is increased bloat).  The code doesn't get smaller or
more readable by using std::string, it gets only smaller because you
merged the default user / explicit user branches.

This line:

    std::string user(user_start, user_end);

is the equivalent of the old:

    g_strndup(path, slash - path)

No difference in readability.

What I don't understand is why you allocate memory for a second copy
of "path".  The original code avoids that.

Btw., this:

    if (!user.size()) {

is more bloated and less readable than:

    if (user.empty()) {

.. because it forces the std::string to determine the size, and the
latter does not.

Max

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to