当前位置: 首页>>代码示例>>C++>>正文


C++ HT_CALLOC函数代码示例

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


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

示例1: HTNewsStatus_new

PRIVATE HTStream * HTNewsStatus_new (HTRequest * request, news_info * news,
				     HTHost * host)
{
    HTStream *me;
    if ((me = (HTStream  *) HT_CALLOC(1, sizeof(HTStream))) == NULL)
        HT_OUTOFMEM("HTNewsStatus_new");
    me->isa = &HTNewsStatusClass;
    me->request = request;
    me->news = news;
    me->EOLstate = EOL_BEGIN;
    me->host = host;
    return me;
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:13,代码来源:HTNews.c

示例2: HTBTree_new

PUBLIC HTBTree * HTBTree_new (HTComparer * comp)
    /*********************************************************
    ** This function returns an HTBTree with memory allocated 
    ** for it when given a mean to compare things
    */
{
    HTBTree * tree;
    if ((tree = (HTBTree  *) HT_CALLOC(1, sizeof(HTBTree))) == NULL)
        HT_OUTOFMEM("HTBTree_new");
    tree->compare = comp;
    tree->top = NULL;
    return tree;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:13,代码来源:HTBTree.c

示例3: HTTee

/*	Tee Stream creation
**	-------------------
**	You can create a T stream using this method. Each stream returns a
**	return value and in order to resolve conflicts in the return code
**	you can specify a resolver callback function. Each time any of the 
**	data methods are called the resolver function is then called with
**	the return codes from the two streams. The return code of the T stream
**	itself will be the result of the resolver function. If you pass NULL
**	as the resolver routine then a default resolver is used.
*/
PUBLIC HTStream * HTTee(HTStream * s1, HTStream * s2, HTComparer * resolver)
{
    HTStream * me;
    if ((me = (HTStream  *) HT_CALLOC(1, sizeof(*me))) == NULL)
        HT_OUTOFMEM("HTTee");
    me->isa = &HTTeeClass;
    me->s1 = s1 ? s1 : HTBlackHole();
    me->s2 = s2 ? s2 : HTBlackHole();
    me->resolver = resolver ? resolver : default_resolver;
    HTTRACE(STREAM_TRACE, "Tee......... Created stream %p with resolver %p\n" _ 
		me _ me->resolver);
    return me;
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:23,代码来源:HTTee.c

示例4: HTChannel_new

/*
**	A channel is uniquely identified by a socket.
**	Note that we don't create the input and output stream - they are
**	created later.
**
**	We only keep a hash on sockfd's as we don't have to look for channels
**	for ANSI file descriptors.
*/
PUBLIC HTChannel * HTChannel_new (SOCKET sockfd, FILE * fp, BOOL active)
{
    HTList * list = NULL;
    HTChannel * ch = NULL;
    int hash = sockfd < 0 ? 0 : HASH(sockfd);
    HTTRACE(PROT_TRACE, "Channel..... Hash value is %d\n" _ hash);
    if (!channels) {
        if (!(channels = (HTList **) HT_CALLOC(HT_M_HASH_SIZE,sizeof(HTList*))))
            HT_OUTOFMEM("HTChannel_new");
    }
    if (!channels[hash]) channels[hash] = HTList_new();
    list = channels[hash];
    if ((ch = (HTChannel *) HT_CALLOC(1, sizeof(HTChannel))) == NULL)
        HT_OUTOFMEM("HTChannel_new");
    ch->sockfd = sockfd;
    ch->fp = fp;
    ch->active = active;
    ch->semaphore = 1;
    ch->channelIStream.isa = &ChannelIStreamIsa;
    ch->channelOStream.isa = &ChannelOStreamIsa;
    ch->channelIStream.channel = ch;
    ch->channelOStream.channel = ch;
    HTList_addObject(list, (void *) ch);

#ifdef HT_MUX
    /*
    **  Create a MUX channel and do a connect on this channel with a
    **  new session.
    */
    {
        HTProtocol * protocol = HTNet_protocol(net);
        HTMuxChannel * muxch = HTMuxChannel_new(me);
        net->session = HTMuxSession_connect(muxch, net, HTProtocol_id(protocol));
    }
#endif /* HT_MUX */

    HTTRACE(PROT_TRACE, "Channel..... Added %p to list %p\n" _ ch _ list);
    return ch;
}
开发者ID:boatgm,项目名称:urchin,代码行数:47,代码来源:HTChannl.c

示例5: HTBind_init

/*	
**	Set up the list of suffix bindings. Done by HTLibInit
*/
PUBLIC BOOL HTBind_init (void)
{
    if (!HTBindings) {
	if (!(HTBindings = (HTList **) HT_CALLOC(HT_L_HASH_SIZE, sizeof(HTList *))))
	    HT_OUTOFMEM("HTBind_init");
    }
    StrAllocCopy(HTDelimiters, DEFAULT_SUFFIXES);
    no_suffix.type = WWW_UNKNOWN;
    no_suffix.encoding = WWW_CODING_BINARY;
    unknown_suffix.type = WWW_UNKNOWN;
    unknown_suffix.encoding = WWW_CODING_BINARY;
    return YES;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:16,代码来源:HTBind.c

示例6: HTAA_newElement

/*
**	A AA element is a particular AA procotol associated with a
**	particular point in the URL tree. The scheme is the name of the
**	AA protocol known to be able to handle this context. This protocol
**	must have been registered as a AA module.
*/
PRIVATE HTAAElement * HTAA_newElement (const char * scheme, void * context)
{
    if (scheme) {
	HTAAElement * me;
	if ((me = (HTAAElement *) HT_CALLOC(1, sizeof(HTAAElement))) == NULL)
	    HT_OUTOFMEM("HTAAElement_new");
	StrAllocCopy(me->scheme, scheme);
	me->context = context;
	HTTRACE(AUTH_TRACE, "Auth Engine. Created element %p\n" _ me);
	return me;
    }
    return NULL;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:19,代码来源:HTAAUtil.c

示例7: HTTPReceive_new

PRIVATE HTStream * HTTPReceive_new (HTRequest * request, https_info * http)
{
    HTStream * me;
    if ((me = (HTStream  *) HT_CALLOC(1, sizeof(HTStream))) == NULL)
        HT_OUTOFMEM("HTTPReceive_new");
    me->isa = &HTTPReceiveClass;
    me->request = request;
    me->http = http;
    me->state = EOL_BEGIN;
    me->buffer = HTChunk_new(128);		 /* Sufficiant for most URLs */
    HTTRACE(STREAM_TRACE, "HTTP Request Stream %p created\n" _ me);
    return me;
}
开发者ID:Rjoydip,项目名称:libwww,代码行数:13,代码来源:HTTPServ.c

示例8: HTTPReply_new

PRIVATE HTStream * HTTPReply_new (HTRequest * request, https_info * http,
                                  HTStream * target)
{
    HTStream * me;
    if ((me = (HTStream  *) HT_CALLOC(1, sizeof(HTStream))) == NULL)
        HT_OUTOFMEM("HTTPReply_new");
    me->isa = &HTTPReplyClass;
    me->request = request;
    me->http = http;
    me->target = target;
    HTTRACE(STREAM_TRACE, "HTTP Reply.. Stream %p created\n" _ me);
    return me;
}
开发者ID:Rjoydip,项目名称:libwww,代码行数:13,代码来源:HTTPServ.c

示例9: HTAnchor_findChild

/*	Create new or find old child anchor
**	-----------------------------------
**
**	Me one is for a new anchor being edited into an existing
**	document. The parent anchor must already exist. All
**	children without tags (no NAME attribut) points to the same NULL
**	child.
**	Children are now hashed for performance reasons. Thanks to
**	Michael Farrar
*/
PUBLIC HTChildAnchor * HTAnchor_findChild (HTParentAnchor *	parent,
					   const char *		tag)
{
    HTChildAnchor * child = NULL;
    HTList * kids = NULL;
    if (!parent) {
	HTTRACE(ANCH_TRACE, "Child Anchor Bad argument\n");
	return NULL;
    }

    /* Find a hash for this tag (if any) */
    {
	int hash = 0;
	/*
	** If tag is empty then use hash value 0
	*/
	if (tag) {
	    const char * ptr = tag;
	    for(; *ptr; ptr++)
		hash = (int) ((hash*3 + (*(unsigned char*)ptr)) % CHILD_HASH_SIZE);
	}
	if (!parent->children) {
	    if (!(parent->children = (HTList **)	
		  HT_CALLOC(CHILD_HASH_SIZE, sizeof(HTList *))))
		HT_OUTOFMEM("HTAnchor_findChild");
	}
	if (!parent->children[hash]) parent->children[hash] = HTList_new();
	kids = parent->children[hash];
    }

    /* First search list of children to see if tag is already there */
    if (tag && *tag) {
	HTList * cur = kids;
	while ((child = (HTChildAnchor *) HTList_nextObject(cur))) {
	    if (child->tag && !strcmp(child->tag, tag)) {
		HTTRACE(ANCH_TRACE, "Child Anchor %p of parent %p with name `%s' already exists.\n" _ 
			    (void *) child _ (void *) parent _ tag);
		return child;
	    }
	}
    }

    /* If not found then create a new child anchor */
    child = HTChildAnchor_new();
    HTList_addObject(kids, (void *) child);
    child->parent = parent;
    if (tag) StrAllocCopy(child->tag, tag);
    HTTRACE(ANCH_TRACE, "Child Anchor New Anchor %p named `%s' is child of %p\n" _ 
		(void *) child _ tag ? tag : (const char *) "" _ (void *)parent);
    return child;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:61,代码来源:HTAnchor.c

示例10: HTAlertCall_add

/*	HTAlertCall_add
**	---------------
**	Register a call back function that is to be called when generating
**	messages, dialog, prompts, progress reports etc.
**
**	The opcode signifies which call back function to call depending of the 
**	type of the message. Opcode can be one of the enumerations defined
**	by HTAlertOpcode.
*/
PUBLIC BOOL HTAlertCall_add (HTList * list, HTAlertCallback * cbf,
			     HTAlertOpcode opcode)
{
    HTTRACE(CORE_TRACE, "Alert Call.. Add Alert Handler %p\n" _ (void *) cbf);
    if (list && cbf) {
	HTAlert *me;
	if ((me = (HTAlert  *) HT_CALLOC(1, sizeof(HTAlert))) == NULL)
	    HT_OUTOFMEM("HTAlertCall_add");
	me->cbf = cbf;
	me->opcode = opcode;
	return HTList_addObject(list, (void *) me);
    }
    return NO;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:23,代码来源:HTAlert.c

示例11: HTPlainPresent

PUBLIC HTStream* HTPlainPresent (HTRequest *	request,
				 void *		param,
				 HTFormat	input_format,
				 HTFormat	output_format,
				 HTStream *	output_stream)
{
    HTStream * me;
    if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL)
        HT_OUTOFMEM("HTPlain_new");
    me->isa = &HTPlain;       
    me->text = HTextImp_new(request, HTRequest_anchor(request), output_stream);
    HTextImp_build(me->text, HTEXT_BEGIN);
    return me;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:14,代码来源:HTPlain.c

示例12: HTMuxProtocol_add

PUBLIC BOOL HTMuxProtocol_add (HTMuxChannel * muxch,
			       HTProtocolId pid, const char * protocol)
{
    if (muxch && protocol) {	
	HTMuxProtocol * ms;
	if ((ms = (HTMuxProtocol *) HT_CALLOC(1, sizeof(HTMuxProtocol))) == NULL)
	    HT_OUTOFMEM("HTMuxProtocol_new");
	ms->name = HTAtom_caseFor(protocol);
	ms->pid = pid;
	if (!muxch->protocols) muxch->protocols = HTList_new();
	return HTList_addObject(muxch->protocols, ms);
    }
    return NO;
}
开发者ID:svagionitis,项目名称:libwww,代码行数:14,代码来源:HTMuxCh.c

示例13: HTXParse

PUBLIC HTStream* HTXParse (HTRequest *	request,
			     void *		param,
			     HTFormat		input_format,
			     HTFormat		output_format,
			     HTStream *		output_stream)
{
    HTStream* me;
  
#ifdef HTDEBUG
    if (STREAM_TRACE) {
	HTTRACE(STREAM_TRACE, "HTXConvert..");
	if (input_format && input_format->name)
            HTTRACE(STREAM_TRACE, ".. input format is %s" _ input_format->name);
	if (output_format && output_format->name)
            HTTRACE(STREAM_TRACE, ".. output format is %s" _ output_format->name);
	HTTRACE(STREAM_TRACE, "\n");
    }
#endif /* HTDEBUG */

    if ((me = (HTStream *) HT_CALLOC(1, sizeof(*me))) == NULL)
        HT_OUTOFMEM("HTXConvert");
    me->isa = &HTXParseClass;

    if ((me->eps = (HTXParseStruct  *) HT_CALLOC(1, sizeof(HTXParseStruct))) == NULL)
        HT_OUTOFMEM("HTXConvert");

    if (input_format)
        me->eps->content_type = input_format->name;
    me->eps->call_client = HTCallClient;
    if ((me->eps->buffer = (char  *) HT_CALLOC(INPUT_BUFFER_SIZE,1)) == NULL)
        HT_OUTOFMEM("HTXParse");
    me->eps->used = 0;
    me->eps->finished = NO;
    me->eps->length = INPUT_BUFFER_SIZE;
    me->eps->request = request;
    return me;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:37,代码来源:HTXParse.c

示例14: HTUserProfile_new

/*
**	Create a new host profile object and initialize it with what we can
**	find on this host.
*/
PUBLIC HTUserProfile * HTUserProfile_new (const char * name, void * context)
{
    HTUserProfile * me = NULL;
    if (name) {
	if ((me = (HTUserProfile *) HT_CALLOC(1, sizeof(HTUserProfile)))==NULL)
	    HT_OUTOFMEM("HTUserProfile_new");

	HTTRACE(CORE_TRACE, "User Profile Adding `%s\'\n" _ name);
	StrAllocCopy(me->user, name);

	/* Set the context */
	me->context = context;
    }
    return me;
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:19,代码来源:HTUser.c

示例15: HTParentAnchor_new

/*
**	Do not use "new" by itself outside this module. In order to enforce
**	consistency, we insist that you furnish more information about the
**	anchor you are creating : use newWithParent or newWithAddress.
*/
PRIVATE HTParentAnchor * HTParentAnchor_new (void)
{
    HTParentAnchor *newAnchor;
    if ((newAnchor = (HTParentAnchor *) HT_CALLOC(1, sizeof (HTParentAnchor))) == NULL)
	HT_OUTOFMEM("HTParentAnchor_new");
    newAnchor->parent = newAnchor;
    newAnchor->content_type = WWW_UNKNOWN;
    newAnchor->mainLink.method = METHOD_INVALID;
    newAnchor->content_length = -1;			 /* howcome 6 dec 95 */
    newAnchor->date = (time_t) -1;
    newAnchor->expires = (time_t) -1;
    newAnchor->last_modified = (time_t) -1;
    newAnchor->age = (time_t) -1;
    return newAnchor;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:20,代码来源:HTAnchor.c


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