[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: webkit-1.8.0-2: Patches for review



Alle martedì 17 aprile 2012, Svante Signell ha scritto:
> BTW: Doesn't the CString resultString; need to be initialized?
> Or something like:
> if (result >= 0 && result < sb.st_size)
>   resultString = CString(readLinkBuffer, result);
> else
>   resultString = CString();

The else branch is not needed, resultString is already initialized.

> Of course the definition of resultString could be placed before first
> statement, but it looks like in C++ people mix freely?

C++ (just like C99, FWIW) allows to declare variables inside code 
blocks, and not strictly at the start of a block.

> +    if (readLinkBuffer == NULL)
> +      return CString();

The return needs 4 spaces of indentation, like the rest of the code.

Now that I saw webkit's code, I'm a bit dubious about the code in 
Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp; it basically does
something like this (simplified for convenience of email):

| #if OS(LINUX)
| CString getCurrentExecutablePath()
| { /* read path from /proc/self/exe */ }
| #elif OS(UNIX)
| CString getCurrentExecutablePath()
| { /* read path from /proc/curproc/file */ }
| #elif OS(WINDOWS)
| CString getCurrentExecutablePath()
| { /* read path using Windows API */ }
| #endif

Your patch would make use of /proc/curproc/file, which would seem to be 
part of the FreeBSD procfs[1]; our procfs is more oriented to emulate 
Linux's one, so IMHO we should either use the Linux code, or add an 
empty getCurrentExecutablePath() like this:

| #elif OS(HURD)
| CString getCurrentExecutablePath()
| { return CString(); }

[1] http://www.unix.com/man-page/FreeBSD/5/procfs/

-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: