[ 
https://issues.apache.org/jira/browse/HDFS-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411861#comment-13411861
 ] 

Andy Isaacson commented on HDFS-3539:
-------------------------------------

{code}
+++ hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/fuse_init.c
...
+#include <strings.h>
{code}
I think <string.h> is preferred.  strings.h was a BSDism IIRC.

(I realize you're just moving code, but let's do the cleanup too.)

{code}
-        tSize num_written_bytes = hdfsWrite(lfs, localFile,
-                                            (void*)fileContents,
-                                            strlen(fileContents) + 1);
+        num_written_bytes = hdfsWrite(lfs, localFile, (void*)fileContents,
+               strlen(fileContents) + 1);
{code}
I'd maintain the indent style here; line up strlen with the (.
Writing the NUL terminator of the string out to the file is a little baroque, 
but I guess it works. Changing the semantics of the code would go beyond 
cleanups.

I'm not entirely convinced that adding an API {{hdfsFileUsesDirectRead}} that 
is only used for tests is a good idea; think of the private data members as 
@VisibleForTest or similar.  But I am fine if you think it's a good cleanup.

I don't think the TestNameNodeRecovery.java whitespace cleanup belongs in this 
patch.  If you were already touching that file for a substantive change it 
would be fine.
                
> libhdfs code cleanups
> ---------------------
>
>                 Key: HDFS-3539
>                 URL: https://issues.apache.org/jira/browse/HDFS-3539
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>            Priority: Minor
>         Attachments: HDFS-3539.001.patch, HDFS-3539.002.patch, 
> HDFS-3539.003.patch, HDFS-3539.004.patch, HDFS-3539.005.patch
>
>
> Fix some compiler warnings, improperly exposed private data types, and 
> extraneous includes in libhdfs.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to