@@ -36,7 +36,7 @@ using COMMAND_CONTEXT = cmd_context;
3636static thread_local std::unique_ptr<cmd_context> g_ctx_key;
3737static thread_local unsigned int g_ctx_refcount;
3838
39- BOOL common_util_build_environment (const char *maildir) try
39+ BOOL cu_build_environment (const char *maildir) try
4040{
4141 /*
4242 * cu_build_env is already called by midb, and then it _may_ occur
@@ -58,7 +58,7 @@ BOOL common_util_build_environment(const char *maildir) try
5858 return false ;
5959}
6060
61- void common_util_free_environment ()
61+ void cu_free_environment ()
6262{
6363 if (--g_ctx_refcount > 0 )
6464 return ;
@@ -69,7 +69,7 @@ void common_util_free_environment()
6969 g_ctx_key.reset ();
7070}
7171
72- void * common_util_alloc (size_t size)
72+ void * cu_alloc_bytes (size_t size)
7373{
7474 auto pctx = g_ctx_key.get ();
7575 if (NULL == pctx) {
@@ -80,7 +80,7 @@ void* common_util_alloc(size_t size)
8080 pctx->alloc_ctx .alloc (size);
8181}
8282
83- BOOL common_util_switch_allocator ()
83+ BOOL cu_switch_allocator ()
8484{
8585 auto pctx = g_ctx_key.get ();
8686 if (NULL == pctx) {
@@ -94,7 +94,7 @@ BOOL common_util_switch_allocator()
9494 return TRUE ;
9595}
9696
97- void common_util_set_maildir (const char *maildir)
97+ void cu_set_maildir (const char *maildir)
9898{
9999 auto pctx = g_ctx_key.get ();
100100 if (pctx == nullptr )
@@ -103,7 +103,7 @@ void common_util_set_maildir(const char *maildir)
103103 gx_strlcpy (pctx->maildir , maildir, std::size (pctx->maildir ));
104104}
105105
106- const char * common_util_get_maildir ()
106+ const char * cu_get_maildir ()
107107{
108108 auto pctx = g_ctx_key.get ();
109109 if (pctx != nullptr )
@@ -112,12 +112,12 @@ const char* common_util_get_maildir()
112112 return NULL ;
113113}
114114
115- char * common_util_dup (const char *pstr)
115+ char * cu_dup (const char *pstr)
116116{
117117 int len;
118118
119119 len = strlen (pstr) + 1 ;
120- auto pstr1 = static_cast <char *>(common_util_alloc (len));
120+ auto pstr1 = static_cast <char *>(cu_alloc_bytes (len));
121121 if (pstr1 == nullptr )
122122 return NULL ;
123123 memcpy (pstr1, pstr, len);
@@ -131,26 +131,25 @@ BINARY *cu_xid_to_bin(const XID &xid)
131131 auto pbin = cu_alloc<BINARY>();
132132 if (pbin == nullptr )
133133 return NULL ;
134- pbin->pv = common_util_alloc (24 );
134+ pbin->pv = cu_alloc_bytes (24 );
135135 if (pbin->pv == nullptr || !ext_push.init (pbin->pv , 24 , 0 ) ||
136136 ext_push.p_xid (xid) != EXT_ERR_SUCCESS)
137137 return NULL ;
138138 pbin->cb = ext_push.m_offset ;
139139 return pbin;
140140}
141141
142- static BOOL common_util_binary_to_xid (const BINARY *pbin, XID *pxid)
142+ static BOOL cu_binary_to_xid (const BINARY *pbin, XID *pxid)
143143{
144144 EXT_PULL ext_pull;
145145
146146 if (pbin->cb < 17 || pbin->cb > 24 )
147147 return FALSE ;
148- ext_pull.init (pbin->pb , pbin->cb , common_util_alloc , 0 );
148+ ext_pull.init (pbin->pb , pbin->cb , cu_alloc_bytes , 0 );
149149 return ext_pull.g_xid (pbin->cb , pxid) == EXT_ERR_SUCCESS ? TRUE : false ;
150150}
151151
152- BINARY* common_util_pcl_append (const BINARY *pbin_pcl,
153- const BINARY *pchange_key)
152+ BINARY *cu_pcl_append (const BINARY *pbin_pcl, const BINARY *pchange_key)
154153{
155154 auto pbin = cu_alloc<BINARY>();
156155 if (pbin == nullptr )
@@ -160,7 +159,7 @@ BINARY* common_util_pcl_append(const BINARY *pbin_pcl,
160159 return nullptr ;
161160 XID xid;
162161 xid.size = pchange_key->cb ;
163- if (!common_util_binary_to_xid (pchange_key, &xid))
162+ if (!cu_binary_to_xid (pchange_key, &xid))
164163 return NULL ;
165164 if (!ppcl.append (xid))
166165 return NULL ;
@@ -169,7 +168,7 @@ BINARY* common_util_pcl_append(const BINARY *pbin_pcl,
169168 if (ptmp_bin == nullptr )
170169 return NULL ;
171170 pbin->cb = ptmp_bin->cb ;
172- pbin->pv = common_util_alloc (ptmp_bin->cb );
171+ pbin->pv = cu_alloc_bytes (ptmp_bin->cb );
173172 if (pbin->pv == nullptr ) {
174173 rop_util_free_binary (ptmp_bin);
175174 return NULL ;
@@ -179,7 +178,7 @@ BINARY* common_util_pcl_append(const BINARY *pbin_pcl,
179178 return pbin;
180179}
181180
182- BOOL common_util_create_folder (const char *dir, int user_id,
181+ BOOL cu_create_folder (const char *dir, int user_id,
183182 uint64_t parent_id, const char *folder_name, uint64_t *pfolder_id)
184183{
185184 BINARY *pbin;
@@ -238,27 +237,24 @@ BOOL common_util_create_folder(const char *dir, int user_id,
238237 return *pfolder_id != 0 ? TRUE : false ;
239238}
240239
241- BOOL common_util_get_propids (const PROPNAME_ARRAY *ppropnames,
242- PROPID_ARRAY *ppropids)
240+ BOOL cu_get_propids (const PROPNAME_ARRAY *ppropnames, PROPID_ARRAY *ppropids)
243241{
244- return exmdb_client::get_named_propids (
245- common_util_get_maildir (), FALSE ,
242+ return exmdb_client::get_named_propids (cu_get_maildir (), false ,
246243 ppropnames, ppropids);
247244}
248245
249- BOOL common_util_get_propids_create (const PROPNAME_ARRAY *names, PROPID_ARRAY *ids)
246+ BOOL cu_get_propids_create (const PROPNAME_ARRAY *names, PROPID_ARRAY *ids)
250247{
251- return exmdb_client::get_named_propids (common_util_get_maildir (),
248+ return exmdb_client::get_named_propids (cu_get_maildir (),
252249 TRUE , names, ids);
253250}
254251
255- BOOL common_util_get_propname (uint16_t propid, PROPERTY_NAME **pppropname) try
252+ BOOL cu_get_propname (uint16_t propid, PROPERTY_NAME **pppropname) try
256253{
257254 PROPNAME_ARRAY propnames;
258255
259- if (!exmdb_client::get_named_propnames (
260- common_util_get_maildir (), {propid}, &propnames) ||
261- propnames.size () != 1 )
256+ if (!exmdb_client::get_named_propnames (cu_get_maildir (),
257+ {propid}, &propnames) || propnames.size () != 1 )
262258 return FALSE ;
263259 *pppropname = propnames.ppropname ;
264260 return TRUE ;
0 commit comments