void u0026_jsonparser__create_1(SG_context* pCtx, SG_string* pStr)
{
	SG_jsonwriter* pjson = NULL;
	char* pid = NULL;

	SG_ERR_CHECK(  SG_jsonwriter__alloc(pCtx, &pjson, pStr)  );

	SG_ERR_CHECK(  SG_jsonwriter__write_start_object(pCtx, pjson)  );

	SG_ERR_CHECK(  SG_jsonwriter__write_pair__string__sz(pCtx, pjson, "hello", "world")  );

	SG_ERR_CHECK(  SG_tid__alloc(pCtx, &pid)  );

	SG_ERR_CHECK(  SG_jsonwriter__write_pair__string__sz(pCtx, pjson, "eyedee", pid)  );
	SG_NULLFREE(pCtx, pid);

	SG_ERR_CHECK(  SG_jsonwriter__write_pair__int64(pCtx, pjson, "x", 5)  );

	SG_ERR_CHECK(  SG_jsonwriter__write_pair__string__sz(pCtx, pjson, "messy", U0026_MESSY)  );

	SG_ERR_CHECK(  SG_jsonwriter__write_end_object(pCtx, pjson)  );

	SG_JSONWRITER_NULLFREE(pCtx, pjson);
	pjson = NULL;

	return;
fail:
	return;
}
Example #2
0
void SG_server__get_temp_fragball_path(SG_context* pCtx,
									   const char* pPushId,
									   const char** ppsz_fragball_name,
									   SG_pathname** ppPath)
{
	SG_pathname* pPath = NULL;
	char* psz_fragball_name = NULL;

	SG_NULLARGCHECK_RETURN(ppsz_fragball_name);
	SG_NULLARGCHECK_RETURN(ppPath);

	SG_ERR_CHECK(  SG_staging__get_pathname__from_id(pCtx, pPushId, &pPath)  );
	SG_ERR_CHECK(  SG_tid__alloc(pCtx, &psz_fragball_name)  );		// TODO consider SG_tid__alloc2(...)

	*ppPath = pPath;
	*ppsz_fragball_name = psz_fragball_name;

	return;
fail:
	SG_PATHNAME_NULLFREE(pCtx, pPath);
	SG_NULLFREE(pCtx, psz_fragball_name);
}