mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-02 18:48:26 +00:00
Remove unneeded XML macros (#2427)
This commit is contained in:
parent
79597c7960
commit
be54c34ecb
@ -115,15 +115,15 @@ int s3fs_utility_processing(time_t abort_time)
|
||||
// parse result(incomplete multipart upload information)
|
||||
S3FS_PRN_DBG("response body = {\n%s\n}", body.c_str());
|
||||
|
||||
xmlDocPtr doc;
|
||||
if(nullptr == (doc = xmlReadMemory(body.c_str(), static_cast<int>(body.size()), "", nullptr, 0))){
|
||||
std::unique_ptr<xmlDoc, decltype(&xmlFreeDoc)> doc(xmlReadMemory(body.c_str(), static_cast<int>(body.size()), "", nullptr, 0), xmlFreeDoc);
|
||||
if(nullptr == doc){
|
||||
S3FS_PRN_DBG("xmlReadMemory exited with error.");
|
||||
result = EXIT_FAILURE;
|
||||
|
||||
}else{
|
||||
// make incomplete uploads list
|
||||
incomp_mpu_list_t list;
|
||||
if(!get_incomp_mpu_list(doc, list)){
|
||||
if(!get_incomp_mpu_list(doc.get(), list)){
|
||||
S3FS_PRN_DBG("get_incomp_mpu_list exited with error.");
|
||||
result = EXIT_FAILURE;
|
||||
|
||||
@ -139,7 +139,6 @@ int s3fs_utility_processing(time_t abort_time)
|
||||
}
|
||||
}
|
||||
}
|
||||
S3FS_XMLFREEDOC(doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
14
src/s3fs.cpp
14
src/s3fs.cpp
@ -3459,7 +3459,6 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter,
|
||||
std::string next_marker;
|
||||
bool truncated = true;
|
||||
S3fsCurl s3fscurl;
|
||||
xmlDocPtr doc;
|
||||
|
||||
S3FS_PRN_INFO1("[path=%s]", path);
|
||||
|
||||
@ -3519,20 +3518,20 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter,
|
||||
std::string encbody = get_encoded_cr_code(body->c_str());
|
||||
|
||||
// xmlDocPtr
|
||||
if(nullptr == (doc = xmlReadMemory(encbody.c_str(), static_cast<int>(encbody.size()), "", nullptr, 0))){
|
||||
std::unique_ptr<xmlDoc, decltype(&xmlFreeDoc)> doc(xmlReadMemory(encbody.c_str(), static_cast<int>(encbody.size()), "", nullptr, 0), xmlFreeDoc);
|
||||
if(nullptr == doc){
|
||||
S3FS_PRN_ERR("xmlReadMemory returns with error.");
|
||||
return -EIO;
|
||||
}
|
||||
if(0 != append_objects_from_xml(path, doc, head)){
|
||||
if(0 != append_objects_from_xml(path, doc.get(), head)){
|
||||
S3FS_PRN_ERR("append_objects_from_xml returns with error.");
|
||||
xmlFreeDoc(doc);
|
||||
return -EIO;
|
||||
}
|
||||
if(true == (truncated = is_truncated(doc))){
|
||||
auto tmpch = get_next_continuation_token(doc);
|
||||
if(true == (truncated = is_truncated(doc.get()))){
|
||||
auto tmpch = get_next_continuation_token(doc.get());
|
||||
if(nullptr != tmpch){
|
||||
next_continuation_token = reinterpret_cast<const char*>(tmpch.get());
|
||||
}else if(nullptr != (tmpch = get_next_marker(doc))){
|
||||
}else if(nullptr != (tmpch = get_next_marker(doc.get()))){
|
||||
next_marker = reinterpret_cast<const char*>(tmpch.get());
|
||||
}
|
||||
|
||||
@ -3553,7 +3552,6 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter,
|
||||
}
|
||||
}
|
||||
}
|
||||
S3FS_XMLFREEDOC(doc);
|
||||
|
||||
// reset(initialize) curl object
|
||||
s3fscurl.DestroyCurlHandle();
|
||||
|
21
src/s3fs.h
21
src/s3fs.h
@ -59,27 +59,6 @@
|
||||
#define S3FS_MALLOCTRIM(pad)
|
||||
#endif // S3FS_MALLOC_TRIM
|
||||
|
||||
#define S3FS_XMLFREEDOC(doc) \
|
||||
do{ \
|
||||
xmlFreeDoc(doc); \
|
||||
S3FS_MALLOCTRIM(0); \
|
||||
}while(0)
|
||||
#define S3FS_XMLFREE(ptr) \
|
||||
do{ \
|
||||
xmlFree(ptr); \
|
||||
S3FS_MALLOCTRIM(0); \
|
||||
}while(0)
|
||||
#define S3FS_XMLXPATHFREECONTEXT(ctx) \
|
||||
do{ \
|
||||
xmlXPathFreeContext(ctx); \
|
||||
S3FS_MALLOCTRIM(0); \
|
||||
}while(0)
|
||||
#define S3FS_XMLXPATHFREEOBJECT(obj) \
|
||||
do{ \
|
||||
xmlXPathFreeObject(obj); \
|
||||
S3FS_MALLOCTRIM(0); \
|
||||
}while(0)
|
||||
|
||||
#endif // S3FS_S3FS_H_
|
||||
|
||||
/*
|
||||
|
@ -65,15 +65,14 @@ static bool GetXmlNsUrl(xmlDocPtr doc, std::string& nsurl)
|
||||
strNs = "";
|
||||
xmlNodePtr pRootNode = xmlDocGetRootElement(doc);
|
||||
if(pRootNode){
|
||||
xmlNsPtr* nslist = xmlGetNsList(doc, pRootNode);
|
||||
std::unique_ptr<xmlNsPtr, decltype(xmlFree)> nslist(xmlGetNsList(doc, pRootNode), xmlFree);
|
||||
if(nslist){
|
||||
if(nslist[0] && nslist[0]->href){
|
||||
int len = xmlStrlen(nslist[0]->href);
|
||||
if(*nslist && (*nslist)[0].href){
|
||||
int len = xmlStrlen((*nslist)[0].href);
|
||||
if(0 < len){
|
||||
strNs = std::string(reinterpret_cast<const char*>(nslist[0]->href), len);
|
||||
strNs = std::string(reinterpret_cast<const char*>((*nslist)[0].href), len);
|
||||
}
|
||||
}
|
||||
S3FS_XMLFREE(nslist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user