[
https://issues.apache.org/jira/browse/HDFS-3916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13453496#comment-13453496
]
Colin Patrick McCabe commented on HDFS-3916:
--------------------------------------------
bq. sizeof(char) is defined to be 1, so code like u = malloc((uriLen + 1) *
(sizeof(char))); should be u = malloc(uriLen++ 1);
ok, will fix
[snip headerstr, strstr, strerror comments]
Good suggestions. Jing just filed HDFS-3920, so let's address these
suggestions there so that this patch doesn't get too large.
bq. [about hdfsExists] Boolean functions in C should return 0 for false and 1
for true. This returns 0 for true and -1 for false.
This is actually part of the libhdfs API. When the file doesn't exist, we're
supposed to return -1 and set {{errno}} = {{ENOENT}}. Actually, I notice we're
not setting {{errno}} here (which is wrong), but the return value is actually
part of the API (unfortunately.) (And before you ask, we probably will come up
with a nicer v2 API some day, but for now let's be compatible) :)
bq. This early exit leaves the LOCK_HASH_TABLE locked...
Good find, will fix.
bq. [test comments]
Let's address these in a separate JIRA. We're going to need an automated test
for libwebhdfs anyway, so we might as well do the cleanup as part of that JIRA,
rather than bundling it into this one.
> libwebhdfs (C client) code cleanups
> -----------------------------------
>
> Key: HDFS-3916
> URL: https://issues.apache.org/jira/browse/HDFS-3916
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: webhdfs
> Affects Versions: 3.0.0
> Reporter: Colin Patrick McCabe
> Assignee: Colin Patrick McCabe
> Attachments: 0002-fix.patch, HDFS-3916.003.patch, HDFS-3916.004.patch
>
>
> Code cleanups in libwebhdfs.
> * don't duplicate exception.c, exception.h, expect.h, jni_helper.c. We have
> one copy of these files; we don't need 2.
> * remember to set errno in all public library functions (this is part of the
> API)
> * fix undefined symbols (if a function is not implemented, it should return
> ENOTSUP, but still exist)
> * don't expose private data structures in the (end-user visible) public
> headers
> * can't re-use hdfsBuilder as hdfsFS, because the strings in hdfsBuilder are
> not dynamically allocated.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira