这篇教程C++ HT_CALLOC函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中HT_CALLOC函数的典型用法代码示例。如果您正苦于以下问题:C++ HT_CALLOC函数的具体用法?C++ HT_CALLOC怎么用?C++ HT_CALLOC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了HT_CALLOC函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: HTNewsStatus_newPRIVATE 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,
示例2: HTBTree_newPUBLIC 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,
示例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,
示例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,
示例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,
示例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,
示例7: HTTPReceive_newPRIVATE 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,
示例8: HTTPReply_newPRIVATE 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,
示例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,
示例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,
示例11: HTPlainPresentPUBLIC 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,
示例12: HTMuxProtocol_addPUBLIC 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,
示例13: HTXParsePUBLIC 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,
示例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,
示例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,
示例16: HTFWriter_newPUBLIC HTStream * HTFWriter_new (HTRequest * request, FILE * fp, BOOL leave_open){ HTStream * me = NULL; if (!fp) { HTTRACE(STREAM_TRACE, "FileWriter.. Bad file descriptor/n"); return HTErrorStream(); } if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) HT_OUTOFMEM("HTFWriter_new"); me->isa = &HTFWriter; me->fp = fp; me->leave_open = leave_open; return me;}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:15,
示例17: HTAssocList_addObjectPUBLIC BOOL HTAssocList_addObject (HTAssocList * list, const char * name, const char * value){ if (list && name) { HTAssoc * assoc; if ((assoc = (HTAssoc *) HT_CALLOC(1, sizeof(HTAssoc))) == NULL) HT_OUTOFMEM("HTAssoc_add"); StrAllocCopy(assoc->name, name); if (value) StrAllocCopy(assoc->value, value); return HTList_addObject(list, (void *) assoc); } else { HTTRACE(UTIL_TRACE, "HTAssoc_add: ERROR: assoc list NULL!!/n"); } return NO;}
开发者ID:svagionitis,项目名称:libwww,代码行数:15,
示例18: HTList_addListPUBLIC HTList * HTList_addList (HTList * me, void * newObject){ if (me) { HTList *newNode; if ((newNode = (HTList *) HT_CALLOC(1, sizeof(HTList))) == NULL) HT_OUTOFMEM("HTList_addObject"); newNode->object = newObject; newNode->next = me->next; me->next = newNode; return newNode; } else { HTTRACE(CORE_TRACE, "HTList...... Can not add object %p to nonexisting List/n" _ newObject); } return (HTList *) NULL;}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:15,
示例19: HTBuffer_newPUBLIC HTStream * HTBuffer_new (HTStream * target, HTRequest * request, int max_size){ HTStream * me; if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) HT_OUTOFMEM("HTBufferStream"); me->isa = &HTBufferClass; me->target = target; me->request = request; me->max_size = (max_size > 0) ? max_size : HT_MAX_SIZE; me->mode = HT_BM_PLAIN; HTTRACE(STREAM_TRACE, "Buffer...... Created with size %d/n" _ me->max_size); return me;}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:15,
示例20: HTWriter_newPUBLIC HTOutputStream * HTWriter_new (HTHost * host, HTChannel * ch, void * param, int mode){ if (host && ch) { HTOutputStream * me = HTChannel_output(ch); if (!me) { if ((me=(HTOutputStream *) HT_CALLOC(1, sizeof(HTOutputStream)))==NULL) HT_OUTOFMEM("HTWriter_new"); me->isa = &HTWriter; me->ch = ch; me->host = host; } return me; } return NULL;}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:16,
示例21: append_bufPRIVATE void append_buf (HTStream * me){ HTBufItem * b; if ((b = (HTBufItem *) HT_CALLOC(1, sizeof(HTBufItem))) == NULL) HT_OUTOFMEM("append_buf"); b->len = me->tmp_ind; b->buf = me->tmp_buf; me->tmp_ind = 0; me->tmp_max = 0; me->tmp_buf = 0; if (me->tail) me->tail->next = b; else me->head = b; me->tail = b;}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:16,
示例22: HTCharset_addPUBLIC void HTCharset_add (HTList * list, const char * charset, double quality){ HTAcceptNode * node; if (!list || !charset || !*charset) { HTTRACE(CORE_TRACE, "Charset..... Bad argument/n"); return; } if ((node = (HTAcceptNode *) HT_CALLOC(1, sizeof(HTAcceptNode))) == NULL) HT_OUTOFMEM("HTAcceptCharsetuage"); HTList_addObject(list, (void*)node); node->atom = HTAtom_for(charset); node->quality = quality;}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:16,
示例23: get_regex_tPRIVATE regex_t * get_regex_t (const char * regex_str, int cflags){ regex_t * regex = NULL; if (regex_str && *regex_str) { int status; if ((regex = (regex_t *) HT_CALLOC(1, sizeof(regex_t))) == NULL) HT_OUTOFMEM("get_regex_t"); if ((status = regcomp(regex, regex_str, cflags))) { char * err_msg = get_regex_error(status, regex); HTTRACE(PROT_TRACE, "HTProxy..... Regular expression error: %s/n" _ err_msg); HT_FREE(err_msg); HT_FREE(regex); } } return regex;}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:16,
示例24: HTLanguage_addPUBLIC void HTLanguage_add (HTList * list, const char * lang, double quality){ HTAcceptNode * node; if (!list || !lang || !*lang) { HTTRACE(CORE_TRACE, "Languages... Bad argument/n"); return; } if ((node = (HTAcceptNode *) HT_CALLOC(1, sizeof(HTAcceptNode))) == NULL) HT_OUTOFMEM("HTAcceptLanguage"); HTList_addObject(list, (void*)node); node->atom = HTAtom_for(lang); node->quality = quality;}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:16,
示例25: ComLine_new/* Create a Command Line Object** ----------------------------*/PRIVATE ComLine * ComLine_new (void){ ComLine * me; if ((me = (ComLine *) HT_CALLOC(1, sizeof(ComLine))) == NULL) HT_OUTOFMEM("ComLine_new"); me->timer = DEFAULT_TIMEOUT*MILLIES; me->cwd = HTGetCurrentDirectoryURL(); me->output = OUTPUT; /* Bind the ConLine object together with the Request Object */ me->request = HTRequest_new(); HTRequest_setOutputFormat(me->request, DEFAULT_FORMAT); HTRequest_setContext (me->request, me); return me;}
开发者ID:svagionitis,项目名称:libwww,代码行数:19,
示例26: HTWSRCConvert/* Converter from WAIS Source to whatever** --------------------------------------*/PUBLIC HTStream* HTWSRCConvert (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("HTWSRCConvert"); me->isa = &WSRCParserClass; me->target = HTMLGenerator(request, param, input_format, output_format, output_stream); me->request = request; me->state = beginning; return me;}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:20,
示例27: HTChunk_putc/* Append a character** ------------------*/PUBLIC void HTChunk_putc (HTChunk * ch, char c){ if (ch) { if (!ch->data || ch->size >= ch->allocated-1) { /* [SIC] bobr */ if (ch->data) { if ((ch->data = (char *) HT_REALLOC(ch->data,ch->allocated+ch->growby)) == NULL) HT_OUTOFMEM("HTChunk_putc"); memset((void *) (ch->data + ch->allocated), '/0', ch->growby); } else { if ((ch->data = (char *) HT_CALLOC(1, ch->allocated+ch->growby)) == NULL) HT_OUTOFMEM("HTChunk_putc"); } ch->allocated += ch->growby; } *(ch->data+ch->size++) = c; }}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:20,
示例28: HTEvent_newPUBLIC HTEvent * HTEvent_new (HTEventCallback * cbf, void * context, HTPriority priority, int millis){ if (cbf) { HTEvent * me; if ((me = (HTEvent *) HT_CALLOC(1, sizeof(HTEvent))) == NULL) HT_OUTOFMEM("HTEvent_new"); me->cbf = cbf; me->param = context; me->priority = priority; me->millis = millis; HTTRACE(CORE_TRACE, "Event....... Created event %p with context %p, priority %d, and timeout %d/n" _ me _ context _ priority _ millis); return me; } return NULL;}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:17,
示例29: HTGuess_newPUBLIC HTStream * HTGuess_new (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("HTGuess_new"); me->isa = &HTGuessClass; me->request = request; me->response = HTRequest_response(request); me->output_format = output_format; me->output_stream = output_stream; me->write_ptr = me->buffer; return me;}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:17,
示例30: HText_new2HText * HText_new2 (HTRequest * request, HTParentAnchor * anchor, HTStream * stream){ HText * me; Robot * mr = (Robot *) HTRequest_context(request); if ((me = (HText *) HT_CALLOC(1, sizeof(HText))) == NULL) HT_OUTOFMEM("HText_new2"); /* Bind the HText object together with the Request Object */ me->request = request; me->first_anchor = me->last_anchor = 0; me->anchors = 0; /* Add this HText object to our list */ mr->htext = me; return me;}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:17,
注:本文中的HT_CALLOC函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ HT_FREE函数代码示例 C++ HTTRACE函数代码示例 |