zhangmeng
2022-12-14 a49287079cb5a97ef65818b70529c9d3bbdd99fa
remove last error for memory taken
2个文件已修改
21 ■■■■■ 已修改文件
src/common.h 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/nng_wrap.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/common.h
@@ -17,17 +17,20 @@
namespace nng_wrap {
static thread_local std::string verbose_info{};
#define TAG
#define PRNTVITAG(args)
/*
#ifndef PRNTVITAG
static thread_local std::string verbose_info{};
#define TAG do{ verbose_info.clear(); \
                verbose_info=string("function [")+__FUNCTION__+string("]"); \
            }while(0)
#define PRNTVITAG(msg) do{ \
            verbose_info+=string("-> (") + msg + string(")"); \
        }while(0)
// #define TAG
// #define PRNTVITAG(args)
#endif
*/
/////////////////////////////////////////////////
enum{
src/nng_wrap.cpp
@@ -68,7 +68,7 @@
}
void set_last_error(const std::string& emsg){
    verbose_info += emsg;
    // verbose_info += emsg;
}
void get_last_error(int* ec, void** emsg, int* emsg_len){
@@ -77,10 +77,12 @@
    *ec = nn_errno();
    const char* msg = nn_strerror(*ec);
    string strMsg(msg);
    strMsg = strMsg + "{" + verbose_info + "}";
    copy_memory(emsg, emsg_len, strMsg.data(), strMsg.size());
    verbose_info.clear();
    // string strMsg(msg);
    // strMsg = strMsg + "{" + verbose_info + "}";
    // copy_memory(emsg, emsg_len, strMsg.data(), strMsg.size());
    // verbose_info.clear();
    copy_memory(emsg, emsg_len, msg, strlen(msg));
}
///////////////////////////////////////////////////////