• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HT_FREE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HT_FREE函数的典型用法代码示例。如果您正苦于以下问题:C++ HT_FREE函数的具体用法?C++ HT_FREE怎么用?C++ HT_FREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HT_FREE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: HTMuxProtocol_delete

PUBLIC BOOL HTMuxProtocol_delete (HTMuxChannel * muxch, HTProtocolId pid)
{
    if (muxch && muxch->protocols) {
	HTList * cur = muxch->protocols;
	HTMuxProtocol * pres;
	while ((pres = (HTMuxProtocol *) HTList_nextObject(cur))) {
	    if (pres->pid == pid) {
		HTList_removeObject(muxch->protocols, pres);
		HT_FREE(pres);
		return YES;
	    }
	}
    }
    return NO;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:15,代码来源:HTMuxCh.c


示例2: HTRuleFilter

/*
**	Rule Translation BEFORE Filter
**	------------------------------
**	If we have a set of rules loaded (see the Rule manager) then check
**	before each request whether how that should be translated. The trick
**	is that a parent anchor has a "address" which is the part from the URL
**	we used when we created the anchor. However, it also have a "physical
**	address" which is the place we are actually going to look for the
**	resource. Hence this filter translates the physical address
**	(if any translations are found)
*/
PUBLIC int HTRuleFilter (HTRequest * request, void * param, int mode)
{
    HTList * list = HTRule_global();
    HTParentAnchor * anchor = HTRequest_anchor(request);
    char * addr = HTAnchor_physical(anchor);
    char * physical = HTRule_translate(list, addr, NO);
    if (!physical) {
	HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN,
			   NULL, 0, "HTRuleFilter");
	return HT_ERROR;
    }
    HTAnchor_setPhysical(anchor, physical);
    HT_FREE(physical);
    return HT_OK;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:26,代码来源:HTFilter.c


示例3: HTextImp_delete

PUBLIC BOOL HTextImp_delete (HTextImp * me)
{
    if (me) {

	/*
	** Note that we do not call the delete method on the app
	** HText object as this normally stays around after the
	** request has been deleted and certainly it should be
	** deleted by the app and not libwww
	*/
	HT_FREE(me);
	return YES;
    }
    return NO;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:15,代码来源:HText.c


示例4: HTBind_getAnchorBindings

/*
**  Use the set of bindings to find the combination of language,
**  media type and encoding of a given object. This information can either be
**  stored in the anchor obejct or in the response object depending on which
**  function is called.
**
**  We comprise here as bindings only can have one language and one encoding.
**  If more than one suffix is found they are all searched. The last suffix
**  has highest priority, the first one lowest. See also HTBind_getFormat()
*/
PUBLIC BOOL HTBind_getAnchorBindings (HTParentAnchor * anchor)
{
    BOOL status = NO;
    double quality=1.0;		  /* @@@ Should we add this into the anchor? */
    if (anchor) {
	char *addr = HTAnchor_address((HTAnchor *) anchor);
	char *path = HTParse(addr, "", PARSE_PATH+PARSE_PUNCTUATION);
	char *file;
	char *end;
	if ((end = strchr(path, ';')) || (end = strchr(path, '?')) ||
	    (end = strchr(path, '#')))
	    *end = '\0';
	if ((file = strrchr(path, '/'))) {
	    HTFormat format = NULL;
	    HTEncoding encoding = NULL;
	    HTEncoding transfer = NULL;
	    HTLanguage language = NULL;
 	    HTTRACE(BIND_TRACE, "Anchor...... Get bindings for `%s\'\n" _ path);
	    status = HTBind_getFormat(file, &format, &encoding, &transfer,
				      &language, &quality);
	    if (status) {
		HTAnchor_setFormat(anchor, format);
		HTAnchor_setContentTransferEncoding(anchor, transfer);

                HTAnchor_deleteEncodingAll(anchor);
                HTAnchor_addEncoding(anchor, encoding);

                HTAnchor_deleteLanguageAll(anchor);
                HTAnchor_addLanguage(anchor, language);
	    }
	}
        HT_FREE(addr);
        HT_FREE(path);
    }
    return status;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:46,代码来源:HTBind.c


示例5: CSParse_put_block

PRIVATE int CSParse_put_block (HTStream * me, const char * b, int l)
{
    if (PICS_TRACE) {
        char * ptr;
        if ((ptr = (char *) HT_MALLOC(l+1)) == NULL)
            HT_OUTOFMEM("diagnostic buffer");
        strncpy(ptr, b, l);
        ptr[l] = 0;
        HTTRACE(PICS_TRACE, "PICS: parser %p parsing block \"%s\"\n" _ me->pCSParse _ ptr);
        HT_FREE(ptr);
    }
    if (CSParse_parseChunk(me->pCSParse, b, l, 0) == CSDoMore_error)
        return HT_ERROR;
    return HT_OK;
}
开发者ID:Rjoydip,项目名称:libwww,代码行数:15,代码来源:CSStream.c


示例6: HTAA_findElement

/*
**	Find AA Element
**	---------------
**	Seaches the set of authentication information bases for a match
**	In order to find an anode we do the following:
**
**		1) Find the right auth base
**		2) See if there is a realm match
**		3) See if there is a template match for URL
**
**	Return the node found else NULL which means that we don't have any
**	authentication information to hook on to this request or response
*/
PRIVATE HTAAElement * HTAA_findElement (BOOL proxy_access,
					const char * realm, const char * url)
{
    HTUTree * tree;
    if (!url) {
	HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n");
	return NULL;
    }
    HTTRACE(AUTH_TRACE, "Auth Engine. Looking up `%s'\n" _ url);

    /* Find an existing URL Tree for this URL (if any) */
    {
	char * host = HTParse(url, "", PARSE_HOST);
	char * colon = strchr(host, ':');
	int port = DEFAULT_PORT;
	if (colon ) {
	    *(colon++) = '\0';			     /* Chop off port number */
	    port = atoi(colon);
	}	
	tree = HTUTree_find(proxy_access ? AA_PROXY_TREE : AA_TREE, host,port);
	HT_FREE(host);
	if (!tree) {
	    HTTRACE(AUTH_TRACE, "Auth Engine. No information\n");
	    return NULL;
	}
    }

    /* Find a matching AA element (if any) */
    {
	char * path = HTParse(url, "", PARSE_PATH | PARSE_PUNCTUATION);
	HTAAElement *element = (HTAAElement*)HTUTree_findNode(tree,realm,path);
	HT_FREE(path);
	return element;
    }
    return NULL;
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:49,代码来源:HTAAUtil.c


示例7: HTTmpAnchor

/*
**	Creates a temporary anchor that doesn't exist
*/
PUBLIC HTParentAnchor * HTTmpAnchor (HTUserProfile * up)
{
    static int offset = 0;			    /* Just keep counting... */
    HTParentAnchor * htpa = NULL;
    time_t t = time(NULL);
    char * tmpfile = HTGetTmpFileName(HTUserProfile_tmp(up));
    char * tmpurl = HTParse(tmpfile, "file:", PARSE_ALL);
    if (tmpfile && tmpurl && t >= 0) {
	char * result;
	if (!(result = (char *) HT_MALLOC(strlen(tmpurl)+20)))
	    HT_OUTOFMEM("HTTmpAnchor");
#ifdef HAVE_LONG_TIME_T
	sprintf(result, "%s.%ld.%d", tmpurl, t, offset++);
#else
	sprintf(result, "%s.%d.%d", tmpurl, t, offset++);
#endif
	HTTRACE(APP_TRACE, "Tmp Anchor.. With location `%s\'\n" _ result);
	htpa = HTAnchor_parent(HTAnchor_findAddress(result));
	HT_FREE(result);
    }
    HT_FREE(tmpfile);
    HT_FREE(tmpurl);
    return htpa;
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:27,代码来源:HTHome.c


示例8: HTNewsCache_update

PRIVATE BOOL HTNewsCache_update (HTRequest * request,
				 const char * url, HTArray * array)
{
    HTUTree * tree = NULL;
    if (request && url) {
	char * newshost = NULL;
	if (!strncasecomp(url, "news:", 5)) {
	    HTUserProfile * up = HTRequest_userProfile(request);
	    StrAllocCopy(newshost, HTUserProfile_news(up));
	} else if (!strncasecomp(url, "nntp:", 5)) {
	    newshost = HTParse(url, "", PARSE_HOST);
	}

	/* 
	**  If the news server was found then update the data entry. Otherwise
	**  create a new entry
	*/
	if (newshost) {
	    char * colon = strchr(newshost, ':');
	    int port = NEWS_PORT;
	    if (colon ) {
		*(colon++) = '\0';		     /* Chop off port number */
		port = atoi(colon);
	    }
	    tree = HTUTree_new(NEWS_TREE, newshost, port, HTNewsCache_delete);
	    HT_FREE(newshost);
	    if (!tree) {
		HTTRACE(PROT_TRACE, "News Cache.. Can't create tree\n");
		return NO;
	    }

	    /* Add new cache information to the tree */
	    {
		HTNewsCache * element = NULL;
		BOOL status;
		if ((element=(HTNewsCache *) HTUTree_findNode(tree, "", "/"))){
		    element->cache = array;
		    status = YES;
		} else {
		    element = HTNewsCache_new(url, array);
		    status = HTUTree_addNode(tree, "", "/", element);
		}
		return status;
	    }
	}
    }
    return NO;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:48,代码来源:HTNewsLs.c


示例9: HTInfoFilter

/*
**	Error and Information AFTER filter
**	----------------------------------
**	It checks the status code from a request and generates an 
**	error/information message if required.
*/
PUBLIC int HTInfoFilter (HTRequest * request, HTResponse * response,
			 void * param, int status)
{
    HTParentAnchor * anchor = HTRequest_anchor(request);
    char * uri = HTAnchor_address((HTAnchor*) anchor);
    switch (status) {
    case HT_RETRY: {
        HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE);
	if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL,
			HTRequest_error(request), NULL);
	HTTRACE(PROT_TRACE, "Load End.... NOT AVAILABLE, RETRY AT %ld\n" _ 
		    HTResponse_retryTime(response));
        }
        break;

    case HT_NO_DATA:
    {
	/*
	** The document was empty
	*/
	HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE);
	if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL,
			HTRequest_error(request), NULL);
	HTTRACE(PROT_TRACE, "Load End.... EMPTY: No content `%s\'\n" _ 
		    uri ? uri : "<UNKNOWN>");
	break;
    }    

    case HT_LOADED:
	HTTRACE(PROT_TRACE, "Load End.... OK: `%s\'\n" _ uri);
	break;

    default:
    {
	/*
	** See if we have a function registered for outputting errors.
	** If so then call it and present the message to the user
	*/
	HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE);
	if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL,
			HTRequest_error(request), NULL);
	HTTRACE(PROT_TRACE, "Load End.... Request ended with code %d\n" _ status);
	break;
    }
    }
    HT_FREE(uri);
    return HT_OK;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:54,代码来源:HTFilter.c


示例10: HTList_removeFirstObject

PUBLIC void * HTList_removeFirstObject  (HTList * me)
{
    if (me && me->next) {
	HTList * prevNode;
	void *firstObject;
	while (me->next) {
	    prevNode = me;
	    me = me->next;
	}
	firstObject = me->object;
	prevNode->next = NULL;
	HT_FREE(me);
	return firstObject;
    } else			/* Empty list */
	return NULL;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:16,代码来源:HTList.c


示例11: HTList_removeObject

PUBLIC BOOL HTList_removeObject (HTList * me, void * oldObject)
{
    if (me) {
	HTList *previous;
	while (me->next) {
	    previous = me;
	    me = me->next;
	    if (me->object == oldObject) {
		previous->next = me->next;
		HT_FREE(me);
		return YES;	/* Success */
	    }
	}
    }
    return NO;			/* object not found or NULL list */
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:16,代码来源:HTList.c


示例12: HTCookieHolder_delete

PRIVATE BOOL HTCookieHolder_delete (HTCookieHolder * me)
{
    if (me) {
        if (me->cookies) {
            HTList * cookies = me->cookies;
            HTCookie * cookie;
            while ((cookie = (HTCookie *) HTList_nextObject(cookies)))
                HTCookie_delete(cookie);
            HTList_delete(me->cookies);
        }
        HTList_removeObject(cookie_holder, me);
        HT_FREE(me);
        return YES;
    }
    return NO;
}
开发者ID:Rjoydip,项目名称:libwww,代码行数:16,代码来源:HTCookie.c


示例13: HTMIME_free

/*	Free a stream object
**	--------------------
*/
PRIVATE int HTMIME_free (HTStream * me)
{
    int status = HT_OK;
    if (!me->transparent)
        if (_stream2dispatchParsers(me) == HT_OK)
	    pumpData(me);
    if (me->target) {
	if ((status = (*me->target->isa->_free)(me->target))==HT_WOULD_BLOCK)
	    return HT_WOULD_BLOCK;
    }
    HTTRACE(PROT_TRACE, "MIME........ FREEING....\n");
    HTChunk_delete(me->token);
    HTChunk_delete(me->value);
    HT_FREE(me);
    return status;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:19,代码来源:HTMIME.c


示例14: HTAlertCall_delete

/*	HTAlertCall_delete
**	------------------
**	Unregister a call back function from a list
*/
PUBLIC BOOL HTAlertCall_delete (HTList * list, HTAlertCallback *cbf)
{
    HTTRACE(CORE_TRACE, "Alert Call..  Delete Alert Handler %p\n" _ (void *) cbf);
    if (list && cbf) {
	HTList *cur = list;
	HTAlert *pres;
	while ((pres = (HTAlert *) HTList_nextObject(cur))) {
	    if (pres->cbf == cbf) {
		HTList_removeObject(list, (void *) pres);
		HT_FREE(pres);
		return YES;
	    }
	}
    }
    return NO;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:20,代码来源:HTAlert.c


示例15: UserProgress

PUBLIC BOOL UserProgress (HTRequest * request, HTAlertOpcode op,
                          int msgnum, const char * dfault, void * input,
                          HTAlertPar * reply)
{
    char * msg = HTDialog_progressMessage(request, op, msgnum, dfault, input);
    CRequest * req = (CRequest *) HTRequest_context(request);
    ASSERT(request != NULL);
    ASSERT(req != NULL);
    CProgressCtrl * progress = req->GetProgressBar();

    switch (op) {
    case HT_PROG_READ:
        {
            long cl = HTAnchor_length(HTRequest_anchor(request));
            if (cl > 0) {
                long b_read = HTRequest_bodyRead(request);
                double pro = (double) b_read/cl*100;
		progress->SetPos((int) pro);
            }
        }
        break;
        
    case HT_PROG_WRITE:
        {
            long cl = HTAnchor_length(HTRequest_entityAnchor(request));
            if (cl > 0) {
                long b_written = HTRequest_bodyWritten(request);
                double pro = (double) b_written/cl*100;
		progress->SetPos((int) pro);
            }
        }
        break;
    }

    // Update pane 0 of the status bar
    if (msg) {
	CWinComDoc * doc = req->m_pDoc;
	if (doc) {
	    POSITION pos = doc->GetFirstViewPosition();
	    CView * view = doc->GetNextView( pos );
	    CMainFrame * mainframe = (CMainFrame *) view->GetParentFrame();
	    mainframe->m_wndStatusBar.SetPaneText(ID_SEPARATOR, msg);
	}
	HT_FREE(msg);
    }
    return YES;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:47,代码来源:UserParameters.cpp


示例16: HTDNS_deleteAll

/*	HTDNS_deleteAll
**	---------------
**	Destroys the cache completely
*/
PUBLIC BOOL HTDNS_deleteAll (void)
{
    int cnt;
    HTList *cur;
    if (!CacheTable) return NO;
    for (cnt=0; cnt<HT_M_HASH_SIZE; cnt++) {
	if ((cur = CacheTable[cnt])) { 
	    HTdns *pres;
	    while ((pres = (HTdns *) HTList_nextObject(cur)) != NULL)
		free_object(pres);
	}
	HTList_delete(CacheTable[cnt]);
	CacheTable[cnt] = NULL;
    }
    HT_FREE(CacheTable);
    return YES;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:21,代码来源:HTDNS.c


示例17: HTMuxChannel_deleteAll

PUBLIC BOOL HTMuxChannel_deleteAll (void)
{
    if (muxchs) {
	HTList * cur;
	int cnt;
	for (cnt=0; cnt<HOST_HASH_SIZE; cnt++) {
	    if ((cur = muxchs[cnt])) { 
		HTMuxChannel * pres;
		while ((pres = (HTMuxChannel *) HTList_nextObject(cur)))
		    channel_delete(pres);
	    }
	    HTList_delete(muxchs[cnt]);
	}
	HT_FREE(muxchs);
    }
    return YES;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:17,代码来源:HTMuxCh.c


示例18: foundLink

PRIVATE void foundLink (HText * text,
			int element_number, int attribute_number,
			HTChildAnchor * anchor,
			const BOOL * present, const char ** value)
{
    if (anchor) {
	/*
	**  Find out which link we got. The anchor we are passed is
	**  a child anchor of the anchor we are current parsing. We
	**  have to go from this child anchor to the actual destination.
	*/
	HTAnchor * dest = HTAnchor_followMainLink((HTAnchor *) anchor);
	char * address = HTAnchor_address(dest);
	HTPrint("Found link `%s\'\n", address);
	HT_FREE(address);
    }
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:17,代码来源:showlinks.c


示例19: HTUseProxyFilter

/*
**	Retry through Proxy AFTER Filter
**	--------------------------------
**	This filter handles a 305 Use Proxy response and retries the request
**	through the proxy
*/
PUBLIC int HTUseProxyFilter (HTRequest * request, HTResponse * response,
			     void * param, int status)
{
    HTAlertCallback * cbf = HTAlert_find(HT_A_CONFIRM);
    HTAnchor * proxy_anchor = HTResponse_redirection(response); 
    if (!proxy_anchor) {
	HTTRACE(PROT_TRACE, "Use Proxy... No proxy location\n");
	return HT_OK;
    }

    /*
    **  Add the proxy to the list. Assume HTTP access method only!
    **  Because evil servers may rediret the client to an untrusted
    **  proxy, we can only accept redirects for this particular
    **  server. Also, we do not know whether this is for HTTP or all
    **  other requests as well
    */
    if ((cbf && (*cbf)(request, HT_A_CONFIRM, HT_MSG_PROXY, NULL,NULL,NULL))) {
	char * addr = HTAnchor_address(proxy_anchor);
	HTProxy_add("http", addr);
	HT_FREE(addr);
 
	/*
	**  Start new request through the proxy if we haven't reached the max
	**  number of redirections for this request
	*/ 
	if (HTRequest_doRetry(request)) { 
	    HTLoadAnchor(proxy_anchor, request);
	} else {
	    HTRequest_addError(request, ERR_FATAL, NO, HTERR_MAX_REDIRECT,
			       NULL, 0, "HTRedirectFilter");
	}

	/*
	**  By returning HT_ERROR we make sure that this is the last handler to be
	**  called. We do this as we don't want any other filter to delete the 
	**  request object now when we have just started a new one ourselves
	*/
	return HT_ERROR;

    } else {
	HTRequest_addError(request, ERR_FATAL, NO, HTERR_NO_AUTO_PROXY,
			   NULL, 0, "HTUseProxyFilter");
	return HT_OK;
    }
} 
开发者ID:svagionitis,项目名称:libwww,代码行数:52,代码来源:HTFilter.c


示例20: HTChannel_deleteAll

/*	HTChannel_deleteAll
**	-------------------
**	Destroys all channels. This is called by HTLibTerminate(0
*/
PUBLIC BOOL HTChannel_deleteAll (void)
{
    if (channels) {
        HTList * cur;
        int cnt;
        for (cnt=0; cnt<HT_M_HASH_SIZE; cnt++) {
            if ((cur = channels[cnt])) {
                HTChannel * pres;
                while ((pres = (HTChannel *) HTList_nextObject(cur)) != NULL)
                    free_channel(pres);
            }
            HTList_delete(channels[cnt]);
        }
        HT_FREE(channels);
    }
    return YES;
}
开发者ID:boatgm,项目名称:urchin,代码行数:21,代码来源:HTChannl.c



注:本文中的HT_FREE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HT_OUTOFMEM函数代码示例发布时间:2022-05-30
下一篇:
C++ HT_CALLOC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap