RFR-8008118

Christos Zoulas christos at zoulas.com
Thu Mar 21 19:11:47 UTC 2013


On Mar 21, 11:36am, john.zavgren at oracle.com (John Zavgren) wrote:
-- Subject: Re: RFR-8008118

| All:
| 
| How does this look?
| 1.) I reverted the for statement formatting change.

Not exactly. Now it is indented incorrectly.

| 2.) I removed the goto statement and "inlined" some code instead.

I prefer to write simpler code that works with both signed and unsigned
indexes:

+                while (i > 0) 
+                    if (pathv[--i] != cwd) 
+                        free(pathv[i]); 
+

| 3.) I checked to make sure that we're not freeing memory that we didn't act=
| ually allocate. (Path vector elements that are empty.)

You are still using the "./" string literal constant in the code so you'll
end up freeing it (the compiler will prolly merge the two instances and
you'll get lucky but it is semantically incorrect).

christos



More information about the core-libs-dev mailing list