本文整理汇总了C++中SG_VHASH_NULLFREE函数的典型用法代码示例。如果您正苦于以下问题:C++ SG_VHASH_NULLFREE函数的具体用法?C++ SG_VHASH_NULLFREE怎么用?C++ SG_VHASH_NULLFREE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SG_VHASH_NULLFREE函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SG_vc_hooks__ASK__WIT__LIST_ITEMS
void SG_vc_hooks__ASK__WIT__LIST_ITEMS(
SG_context* pCtx,
SG_repo* pRepo,
const char * psz_search_term,
SG_varray *pBugs
)
{
SG_vhash* pvh_params = NULL;
SG_vhash* pvh_result = NULL;
SG_vhash* pvh_hook = NULL;
const char* psz_js = NULL;
const char* psz_descriptor_name = NULL;
SG_bool hasBugs = SG_FALSE;
SG_ERR_CHECK( sg_vc_hooks__lookup_by_interface__single_result(
pCtx,
pRepo,
SG_VC_HOOK__INTERFACE__ASK__WIT__LIST_ITEMS,
&pvh_hook
) );
if (!pvh_hook)
return;
SG_ERR_CHECK( SG_vhash__get__sz(pCtx, pvh_hook, "js", &psz_js) );
SG_ERR_CHECK( SG_VHASH__ALLOC(pCtx, &pvh_params) );
SG_ERR_CHECK( SG_repo__get_descriptor_name(pCtx, pRepo, &psz_descriptor_name) );
SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh_params, "descriptor_name", psz_descriptor_name) );
SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh_params, "text", psz_search_term) );
SG_ERR_CHECK( SG_vc_hooks__execute(pCtx, psz_js, pvh_params, &pvh_result) );
SG_ERR_CHECK( SG_vhash__has(pCtx, pvh_result, "items", &hasBugs) );
if (hasBugs && pBugs)
{
SG_varray *bugs = NULL;
SG_ERR_CHECK( SG_vhash__get__varray(pCtx, pvh_result, "items", &bugs) );
SG_ERR_CHECK( SG_varray__copy_items(pCtx, bugs, pBugs) );
}
fail:
SG_VHASH_NULLFREE(pCtx, pvh_params);
SG_VHASH_NULLFREE(pCtx, pvh_result);
SG_VHASH_NULLFREE(pCtx, pvh_hook);
}
示例2: MyFn
/**
* List the hashes supported by each repo implementation.
*
* NOTE: I don't have a way to verify that the list is complete or verify
* NOTE: what it should contain, so I just print the list.
*/
void MyFn(list_hashes)(SG_context * pCtx)
{
SG_repo * pRepo = NULL;
SG_vhash * pvh_vtables = NULL;
SG_vhash * pvh_HashMethods = NULL;
SG_uint32 k, count_vtables;
VERIFY_ERR_CHECK( SG_repo__query_implementation(pCtx,NULL,
SG_REPO__QUESTION__VHASH__LIST_REPO_IMPLEMENTATIONS,
NULL,NULL,NULL,0,
&pvh_vtables) );
VERIFY_ERR_CHECK( SG_vhash__count(pCtx,pvh_vtables,&count_vtables) );
for (k=0; k<count_vtables; k++)
{
const char * pszKey_vtable_k;
SG_uint32 j, count_HashMethods;
VERIFY_ERR_CHECK( SG_vhash__get_nth_pair(pCtx,pvh_vtables,k,&pszKey_vtable_k,NULL) );
INFOP("vtable",("Repo Implementation[%d]: [%s]",k,pszKey_vtable_k));
VERIFY_ERR_CHECK( SG_repo__alloc(pCtx,&pRepo,pszKey_vtable_k) );
VERIFY_ERR_CHECK( SG_repo__query_implementation(pCtx,pRepo,
SG_REPO__QUESTION__VHASH__LIST_HASH_METHODS,
NULL,NULL,NULL,0,
&pvh_HashMethods) );
VERIFY_ERR_CHECK( SG_vhash__count(pCtx,pvh_HashMethods,&count_HashMethods) );
for (j=0; j<count_HashMethods; j++)
{
const char * pszKey_HashMethod_j;
const SG_variant * pVariant;
SG_int64 i64;
SG_uint32 strlen_Hash_j;
VERIFY_ERR_CHECK( SG_vhash__get_nth_pair(pCtx,pvh_HashMethods,j,&pszKey_HashMethod_j,&pVariant) );
VERIFY_ERR_CHECK( SG_variant__get__int64(pCtx,pVariant,&i64) );
strlen_Hash_j = (SG_uint32)i64;
INFOP("vtable.hash_method",("Repo [%s] Hash [%s] Length [%d]",pszKey_vtable_k,pszKey_HashMethod_j,strlen_Hash_j));
}
SG_VHASH_NULLFREE(pCtx, pvh_HashMethods);
SG_REPO_NULLFREE(pCtx, pRepo);
}
fail:
SG_VHASH_NULLFREE(pCtx, pvh_HashMethods);
SG_REPO_NULLFREE(pCtx, pRepo);
SG_VHASH_NULLFREE(pCtx, pvh_vtables);
}
示例3: u0038_test_wdmapping
void u0038_test_wdmapping(SG_context * pCtx)
{
SG_vhash* pvh = NULL;
SG_closet_descriptor_handle* ph = NULL;
SG_pathname* pPath = NULL;
SG_pathname* pMappedPath = NULL;
SG_string* pstrRepoDescriptorName = NULL;
char* pszidGid = NULL;
char buf_tid[SG_TID_MAX_BUFFER_LENGTH];
VERIFY_ERR_CHECK_DISCARD( SG_tid__generate2__suffix(pCtx, buf_tid, sizeof(buf_tid), 32, "u0038") );
VERIFY_ERR_CHECK_DISCARD( SG_PATHNAME__ALLOC__SZ(pCtx, &pPath, buf_tid) );
VERIFY_ERR_CHECK_DISCARD( SG_fsobj__mkdir__pathname(pCtx, pPath) );
SG_ERR_IGNORE( SG_closet__descriptors__remove(pCtx, "r1") );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_begin(pCtx, "r1", NULL, NULL, NULL, NULL, &pvh, &ph) );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_commit(pCtx, &ph, pvh, SG_REPO_STATUS__NORMAL) );
SG_VHASH_NULLFREE(pCtx, pvh);
VERIFY_ERR_CHECK_DISCARD( SG_workingdir__set_mapping(pCtx, pPath, "r1", NULL) );
VERIFY_ERR_CHECK_DISCARD( SG_workingdir__find_mapping(pCtx, pPath, &pMappedPath, &pstrRepoDescriptorName, &pszidGid) );
VERIFY_COND("ridesc match", (0 == strcmp("r1", SG_string__sz(pstrRepoDescriptorName))));
VERIFY_ERR_CHECK_DISCARD( SG_pathname__append__from_sz(pCtx, pPath, "foo") );
VERIFY_ERR_CHECK_DISCARD( SG_pathname__append__from_sz(pCtx, pPath, "bar") );
VERIFY_ERR_CHECK_DISCARD( SG_pathname__append__from_sz(pCtx, pPath, "plok") );
SG_STRING_NULLFREE(pCtx, pstrRepoDescriptorName);
SG_PATHNAME_NULLFREE(pCtx, pMappedPath);
VERIFY_ERR_CHECK_DISCARD( SG_workingdir__find_mapping(pCtx, pPath, &pMappedPath, &pstrRepoDescriptorName, &pszidGid) );
SG_STRING_NULLFREE(pCtx, pstrRepoDescriptorName);
SG_PATHNAME_NULLFREE(pCtx, pMappedPath);
SG_PATHNAME_NULLFREE(pCtx, pPath);
}
示例4: SG_sync_remote__push_commit
void SG_sync_remote__push_commit(
SG_context* pCtx,
SG_repo* pRepo,
const char* pszPushId,
SG_vhash** ppResult
)
{
SG_staging* pStaging = NULL;
SG_vhash* pvh_status = NULL;
SG_NULLARGCHECK_RETURN(pszPushId);
SG_NULLARGCHECK_RETURN(ppResult);
SG_ERR_CHECK( SG_staging__open(pCtx, pszPushId, &pStaging) );
SG_ERR_CHECK( SG_staging__commit(pCtx, pStaging, pRepo) );
SG_ERR_CHECK( SG_staging__check_status(pCtx, pStaging, pRepo,
SG_TRUE, SG_FALSE, SG_TRUE, SG_TRUE, SG_FALSE,
&pvh_status) );
*ppResult = pvh_status;
pvh_status = NULL;
/* fallthru */
fail:
SG_VHASH_NULLFREE(pCtx, pvh_status);
SG_STAGING_NULLFREE(pCtx, pStaging);
}
示例5: u0026_jsonparser__test_jsonparser_vhash_2
void u0026_jsonparser__test_jsonparser_vhash_2(SG_context * pCtx)
{
SG_string* pstr1 = NULL;
SG_string* pstr2 = NULL;
SG_vhash* pvh = NULL;
VERIFY_ERR_CHECK( SG_STRING__ALLOC(pCtx, &pstr1) );
VERIFY_ERR_CHECK( SG_STRING__ALLOC(pCtx, &pstr2) );
VERIFY_ERR_CHECK( u0026_jsonparser__create_2(pCtx, pstr1) );
SG_VHASH__ALLOC__FROM_JSON__SZ(pCtx, &pvh, SG_string__sz(pstr1));
VERIFY_COND("from_json", !SG_context__has_err(pCtx));
VERIFY_COND("from_json", pvh);
SG_context__err_reset(pCtx);
SG_vhash__to_json(pCtx, pvh, pstr2);
VERIFY_COND("from_json", !SG_context__has_err(pCtx));
// TODO do some checks
fail:
SG_STRING_NULLFREE(pCtx, pstr1);
SG_STRING_NULLFREE(pCtx, pstr2);
SG_VHASH_NULLFREE(pCtx, pvh);
}
示例6: SG_mrg__free
void SG_mrg__free(SG_context * pCtx, SG_mrg * pMrg)
{
if (!pMrg)
return;
//////////////////////////////////////////////////////////////////
pMrg->pMergeArgs = NULL; // we do not own this
pMrg->pWcTx = NULL; // we do not own this
//////////////////////////////////////////////////////////////////
SG_VHASH_NULLFREE(pCtx, pMrg->pvhPile);
SG_NULLFREE(pCtx, pMrg->pszHid_StartingBaseline);
SG_NULLFREE(pCtx, pMrg->pszBranchName_Starting);
SG_NULLFREE(pCtx, pMrg->pszHidTarget);
//////////////////////////////////////////////////////////////////
SG_DAGLCA_NULLFREE(pCtx,pMrg->pDagLca);
SG_MRG_CSET_NULLFREE(pCtx, pMrg->pMrgCSet_LCA);
SG_MRG_CSET_NULLFREE(pCtx, pMrg->pMrgCSet_Baseline);
SG_MRG_CSET_NULLFREE(pCtx, pMrg->pMrgCSet_Other);
SG_MRG_CSET_NULLFREE(pCtx,pMrg->pMrgCSet_FinalResult);
SG_RBTREE_NULLFREE_WITH_ASSOC(pCtx,pMrg->prbCSets_Aux,(SG_free_callback *)SG_mrg_cset__free);
SG_VECTOR_I64_NULLFREE(pCtx, pMrg->pVecRevertAllKillList);
SG_NULLFREE(pCtx, pMrg);
}
示例7: sg_client__c__pull_clone
void sg_client__c__pull_clone(
SG_context* pCtx,
SG_client* pClient,
const SG_pathname* pStagingPathname,
char** ppszFragballName)
{
sg_client_c_instance_data* pMe = NULL;
SG_repo* pRepo = NULL;
SG_vhash* pvhStatus = NULL;
SG_NULLARGCHECK_RETURN(pClient);
SG_NULLARGCHECK_RETURN(ppszFragballName);
pMe = (sg_client_c_instance_data*)pClient->p_vtable_instance_data;
SG_ERR_CHECK( SG_repo__open_repo_instance(pCtx, pClient->psz_remote_repo_spec, &pRepo) );
SG_ERR_CHECK( SG_context__msg__emit(pCtx, "Copying repository...") );
SG_ERR_CHECK( SG_repo__fetch_repo__fragball(pCtx, pRepo, pStagingPathname, ppszFragballName) );
SG_ERR_CHECK( SG_context__msg__emit(pCtx, "done") );
/* fall through */
fail:
SG_REPO_NULLFREE(pCtx, pRepo);
SG_VHASH_NULLFREE(pCtx, pvhStatus);
SG_ERR_IGNORE( SG_context__msg__emit(pCtx, "\n") );
}
示例8: sg_wc_tx__queue__resolve_issue__sr
/**
* Queue a request to resolve (or partially resolve) an issue.
* We assume that the caller has already
* queued any necessary WD operations
* (such as moves/renamed) and now just
* needs to mark the item resolved (or
* partially resolved).
*
* Since an item may have multiple conflict
* bits set, you can use this to mark the
* specific choices made in the pvhSavedResolutions
* and only mark it fully resolved when
* everything has been chosen.
*
* We steal the optional/given pvhSavedResolutions.
*
*/
void sg_wc_tx__queue__resolve_issue__sr(SG_context * pCtx,
SG_wc_tx * pWcTx,
sg_wc_liveview_item * pLVI,
SG_wc_status_flags statusFlags_x_xr_xu,
SG_vhash ** ppvhSavedResolutions)
{
SG_string * pStringResolveData = NULL;
SG_NULLARGCHECK_RETURN( pWcTx );
SG_NULLARGCHECK_RETURN( pLVI );
// ppvhSavedResolutions is optional.
if (ppvhSavedResolutions && *ppvhSavedResolutions)
{
SG_ERR_CHECK( SG_STRING__ALLOC(pCtx, &pStringResolveData) );
SG_ERR_CHECK( SG_vhash__to_json(pCtx, (*ppvhSavedResolutions), pStringResolveData) );
}
SG_ERR_CHECK( sg_wc_tx__journal__resolve_issue__sr(pCtx, pWcTx,
pLVI->uiAliasGid,
statusFlags_x_xr_xu,
pStringResolveData) );
pLVI->statusFlags_x_xr_xu = statusFlags_x_xr_xu;
SG_VHASH_NULLFREE(pCtx, pLVI->pvhSavedResolutions);
if (ppvhSavedResolutions && *ppvhSavedResolutions)
{
pLVI->pvhSavedResolutions = *ppvhSavedResolutions;
*ppvhSavedResolutions = NULL;
}
fail:
SG_STRING_NULLFREE(pCtx, pStringResolveData);
}
示例9: SG_sync_remote__heartbeat
void SG_sync_remote__heartbeat(
SG_context* pCtx,
SG_repo* pRepo,
SG_vhash** ppvh)
{
SG_vhash* pvh = NULL;
char* pszRepoId = NULL;
char* pszAdminId = NULL;
char* pszHashMethod = NULL;
SG_ERR_CHECK( SG_VHASH__ALLOC(pCtx, &pvh) );
SG_ERR_CHECK( SG_repo__get_repo_id(pCtx, pRepo, &pszRepoId) );
SG_ERR_CHECK( SG_repo__get_admin_id(pCtx, pRepo, &pszAdminId) );
SG_ERR_CHECK( SG_repo__get_hash_method(pCtx, pRepo, &pszHashMethod) );
SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh, SG_SYNC_REPO_INFO_KEY__REPO_ID, pszRepoId) );
SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh, SG_SYNC_REPO_INFO_KEY__ADMIN_ID, pszAdminId) );
SG_ERR_CHECK( SG_vhash__add__string__sz(pCtx, pvh, SG_SYNC_REPO_INFO_KEY__HASH_METHOD, pszHashMethod) );
*ppvh = pvh;
pvh = NULL;
/* fall through */
fail:
SG_VHASH_NULLFREE(pCtx, pvh);
SG_NULLFREE(pCtx, pszRepoId);
SG_NULLFREE(pCtx, pszAdminId);
SG_NULLFREE(pCtx, pszHashMethod);
}
示例10: _node__free_nonreusable_memory
static void _node__free_nonreusable_memory(SG_context * pCtx, _node_t * pNode)
{
SG_ASSERT(pNode!=NULL);
SG_DAGNODE_NULLFREE(pCtx, pNode->pDagnode);
SG_VARRAY_NULLFREE(pCtx, pNode->pAudits);
SG_VHASH_NULLFREE(pCtx, pNode->pVcParents);
}
示例11: u0038_test_ridesc
void u0038_test_ridesc(SG_context * pCtx)
{
SG_closet_descriptor_handle* ph = NULL;
SG_vhash* pvh = NULL;
SG_vhash* pvh_all = NULL;
SG_uint32 count = 0;
SG_ERR_IGNORE( SG_closet__descriptors__remove(pCtx, "1") );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_begin(pCtx, "1", NULL, NULL, NULL, NULL, &pvh, &ph) );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_commit(pCtx, &ph, pvh, SG_REPO_STATUS__NORMAL));
SG_VHASH_NULLFREE(pCtx, pvh);
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__remove(pCtx, "1") );
SG_ERR_IGNORE( SG_closet__descriptors__remove(pCtx, "2") ); /* This may or may not be an error */
/* delete one that is not there should be an error */
VERIFY_ERR_CHECK_HAS_ERR_DISCARD( SG_closet__descriptors__remove(pCtx, "2") );
/* fetch one that is not there should be an error */
VERIFY_ERR_CHECK_HAS_ERR_DISCARD( SG_closet__descriptors__get(pCtx, "2", NULL, &pvh) );
VERIFY_COND("", pvh==NULL);
SG_ERR_IGNORE( SG_closet__descriptors__remove(pCtx, "3") );
SG_ERR_IGNORE( SG_closet__descriptors__remove(pCtx, "4") );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_begin(pCtx, "3", NULL, NULL, NULL, NULL, &pvh, &ph) );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_commit(pCtx, &ph, pvh, SG_REPO_STATUS__NORMAL) );
SG_VHASH_NULLFREE(pCtx, pvh);
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_begin(pCtx, "4", NULL, NULL, NULL, NULL, &pvh, &ph) );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__add_commit(pCtx, &ph, pvh, SG_REPO_STATUS__NORMAL) );
SG_VHASH_NULLFREE(pCtx, pvh);
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__get(pCtx, "3", NULL, &pvh) );
VERIFY_ERR_CHECK_DISCARD( SG_closet__descriptors__list(pCtx, &pvh_all) );
VERIFY_ERR_CHECK_DISCARD( SG_vhash__count(pCtx, pvh_all, &count) );
/* adding a duplicate name should be an error */
VERIFY_ERR_CHECK_ERR_EQUALS_DISCARD(
SG_closet__descriptors__add_begin(pCtx, "3", NULL, NULL, NULL, NULL, NULL, &ph),
SG_ERR_REPO_ALREADY_EXISTS);
VERIFY_COND("count", (count >= 2));
SG_ERR_IGNORE( SG_closet__descriptors__remove(pCtx, "3") );
SG_ERR_IGNORE( SG_closet__descriptors__remove(pCtx, "4") );
SG_VHASH_NULLFREE(pCtx, pvh_all);
SG_VHASH_NULLFREE(pCtx, pvh);
}
示例12: SG_dbrecord__free
void SG_dbrecord__free(SG_context * pCtx, SG_dbrecord* prec)
{
if (!prec)
return;
SG_VHASH_NULLFREE(pCtx, prec->pvh);
SG_NULLFREE(pCtx, prec->pid);
SG_NULLFREE(pCtx, prec);
}