本文整理汇总了C++中outofmem函数的典型用法代码示例。如果您正苦于以下问题:C++ outofmem函数的具体用法?C++ outofmem怎么用?C++ outofmem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outofmem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ARGS4
/*
** String Allocate and Concatenate.
** Tracks allocations by using other LYLeakFoo functions.
** Equivalent to HTSACat in HTUtils.c - KW
*/
PUBLIC char * LYLeakSACat ARGS4(
char **, dest,
CONST char *, src,
CONST char *, cp_File,
CONST short, ssi_Line)
{
if (src && *src) {
if (src == *dest) {
CTRACE((tfp,
"LYLeakSACat: *dest equals src, contains \"%s\"\n",
src));
return *dest;
}
if (*dest) {
int length = strlen(*dest);
*dest = (char *)LYLeakRealloc(*dest,
(length + strlen(src) + 1),
cp_File,
ssi_Line);
if (*dest == NULL)
outofmem(__FILE__, "LYLeakSACat");
strcpy (*dest + length, src);
} else {
*dest = (char *)LYLeakMalloc((strlen(src) + 1),
cp_File,
ssi_Line);
if (*dest == NULL)
outofmem(__FILE__, "LYLeakSACat");
strcpy (*dest, src);
}
}
return *dest;
}
开发者ID:avsm,项目名称:openbsd-lynx,代码行数:38,代码来源:LYLeaks.c
示例2: ARGS5
PUBLIC HTStream* HTExtParse ARGS5(
HTRequest *, request,
void *, param,
HTFormat, input_format,
HTFormat, output_format,
HTStream *, output_stream)
{
HTStream* me;
if (TRACE) {
printf("HTExtConvert..");
if (input_format && input_format->name)
printf (".. input format is %s",input_format->name);
if (output_format && output_format->name)
printf (".. output format is %s",output_format->name);
printf("\n");
}
me = (HTStream*)calloc(1, sizeof(*me));
if (me == NULL) outofmem(__FILE__, "HTExtConvert");
me->isa = &HTExtParseClass;
me->eps = (HTExtParseStruct *) calloc(1, sizeof(HTExtParseStruct));
if (me->eps == NULL) outofmem(__FILE__, "HTExtConvert");
me->eps->content_type = input_format->name;
me->eps->call_client = HTCallClient;
me->eps->buffer = (char *)calloc(INPUT_BUFFER_SIZE,1);
me->eps->used = 0;
me->eps->finished = NO;
me->eps->length = INPUT_BUFFER_SIZE;
me->eps->request = request;
return me;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:34,代码来源:HTExtParse.c
示例3: ARGS7
/* HTErrorAdd
**
** Add an error message to the error list in HTRequest. `par' and `where'
** might be set to NULL. If par is a string, it is sufficient to let
** par_length be unspecified, i.e., 0. If only a part of the string is
** wanted then specify a par_length inferior to strlen((char *) par).
** The string is '\0' terminated automaticly.
**
** NOTE: See also HTErrorSysAdd for system errors
**
** Returns always < 0
*/
PUBLIC int HTErrorAdd ARGS7(HTRequest *, request,
HTErrSeverity, severity,
BOOL, ignore,
int, element,
void *, par,
unsigned int, par_length,
char *, where)
{
HTErrorInfo *newError;
if (!request) {
if (TRACE) fprintf(stderr, "HTErrorAdd.. Bad argument!\n");
return -1;
}
if ((newError = (HTErrorInfo *) calloc(1, sizeof(HTErrorInfo))) == NULL)
outofmem(__FILE__, "HTErrorAdd");
newError->element = element;
newError->severity = severity;
newError->ignore = ignore;
if (par) {
if (!par_length)
par_length = (int) strlen((char *) par);
if ((newError->par = malloc(par_length+1)) == NULL)
outofmem(__FILE__, "HTErrorError");
memcpy(newError->par, par, par_length);
*(((char *) newError->par)+par_length) = '\0';
newError->par_length = par_length;
}
newError->where = where;
/* Add to the stack in the request structure */
if (!request->error_stack)
request->error_stack = HTList_new();
else { /* Get last object in order to find a handle */
HTList *cur = request->error_stack;
HTErrorInfo *pres = (HTErrorInfo *) HTList_nextObject(cur);
if (pres != NULL)
newError->handle = pres->handle+1;
}
if (TRACE) {
fprintf(stderr, "Message..... Handle: %d\tCode: %3d\tMessage: `%s\'\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n",
newError->handle,
error_info[newError->element].code,
error_info[newError->element].msg,
newError->severity,
newError->par ? (char *) newError->par : "Unspecified",
newError->where ? newError->where : "Unspecified");
}
HTList_addObject(request->error_stack, (void *) newError);
return (-element);
}
开发者ID:tjgillies,项目名称:cern-httpd,代码行数:62,代码来源:HTError.c
示例4: NXScanf
HTStyle *HTStyleRead(HTStyle *style, HTStream *stream)
{
char myTag[STYLE_NAME_LENGTH];
char fontName[STYLE_NAME_LENGTH];
NXTextStyle *p;
int tab;
int gotpara; /* flag: have we got a paragraph definition? */
NXScanf(stream, "%s%s%f%d",
myTag,
fontName,
&style->fontSize,
&gotpara);
if (gotpara) {
if (!style->paragraph) {
style->paragraph = malloc(sizeof(*(style->paragraph)));
if (!style->paragraph)
outofmem(__FILE__, "HTStyleRead");
style->paragraph->tabs = 0;
}
p = style->paragraph;
NXScanf(stream, "%f%f%f%f%hd%f%f%hd",
&p->indent1st,
&p->indent2nd,
&p->lineHt,
&p->descentLine,
&p->alignment,
&style->spaceBefore,
&style->spaceAfter,
&p->numTabs);
FREE(p->tabs);
p->tabs = malloc(p->numTabs * sizeof(p->tabs[0]));
if (!p->tabs)
outofmem(__FILE__, "HTStyleRead");
for (tab = 0; tab < p->numTabs; tab++) {
NXScanf(stream, "%hd%f",
&p->tabs[tab].kind,
&p->tabs[tab].x);
}
} else { /* No paragraph */
FREE(style->paragraph);
} /* if no paragraph */
StrAllocCopy(style->SGMLTag, myTag);
if (strcmp(fontName, NONE_STRING) == 0)
style->font = 0;
else
style->font =[Font newFont: fontName size:style->fontSize];
return NULL;
}
开发者ID:AaronDP,项目名称:lynx_adbshell,代码行数:49,代码来源:HTStyle.c
示例5: ARGS1
PUBLIC HTAtom * HTAtom_for ARGS1(CONST char *, string)
{
int hash;
HTAtom * a;
/* First time around, clear hash table
*/
/*
* Memory leak fixed.
* 05-29-94 Lynx 2-3-1 Garrett Arch Blythe
*/
if (!initialised) {
int i;
for (i = 0; i < HASH_SIZE; i++)
hash_table[i] = (HTAtom *) 0;
initialised = YES;
atexit(free_atoms);
}
/* Generate hash function
*/
hash = HASH_FUNCTION(string);
/* Search for the string in the list
*/
for (a = hash_table[hash]; a; a = a->next) {
if (0 == strcasecomp(a->name, string)) {
/* CTRACE(tfp, "HTAtom: Old atom %p for `%s'\n", a, string); */
return a; /* Found: return it */
}
}
/* Generate a new entry
*/
a = (HTAtom *)malloc(sizeof(*a));
if (a == NULL)
outofmem(__FILE__, "HTAtom_for");
a->name = (char *)malloc(strlen(string)+1);
if (a->name == NULL)
outofmem(__FILE__, "HTAtom_for");
strcpy(a->name, string);
a->next = hash_table[hash]; /* Put onto the head of list */
hash_table[hash] = a;
#ifdef NOT_DEFINED
CTRACE(tfp, "HTAtom: New atom %p for `%s'\n", a, string);
#endif /* NOT_DEFINED */
return a;
}
开发者ID:OS2World,项目名称:APP-INTERNET-Lynx,代码行数:48,代码来源:HTAtom.c
示例6: ARGS2
/* Create a chunk with a certain allocation unit and ensured size
** --------------
*/
PUBLIC HTChunk * HTChunkCreate2 ARGS2 (int,grow, size_t, needed)
{
HTChunk * ch = typecalloc(HTChunk);
if (ch == NULL)
outofmem(__FILE__, "HTChunkCreate2");
HTChunkInit (ch, grow);
if (needed > 0) {
ch->allocated = needed-1 - ((needed-1) % ch->growby)
+ ch->growby; /* Round up */
CTRACE((tfp, "HTChunkCreate2: requested %d, allocate %d\n",
(int) needed, ch->allocated));
ch->data = typecallocn(char, ch->allocated);
if (!ch->data)
outofmem(__FILE__, "HTChunkCreate2 data");
}
开发者ID:avsm,项目名称:openbsd-lynx,代码行数:19,代码来源:HTChunk.c
示例7: LYAllocHistory
void LYAllocHistory(int entries)
{
CTRACE((tfp, "LYAllocHistory %d vs %d\n", entries, size_history));
if (entries + 1 >= size_history) {
unsigned want;
int save = size_history;
size_history = (entries + 2) * 2;
want = (unsigned) size_history *(unsigned) sizeof(*history);
if (history == 0) {
history = typeMallocn(HistInfo, want);
} else {
history = typeRealloc(HistInfo, history, want);
}
if (history == 0)
outofmem(__FILE__, "LYAllocHistory");
assert(history != NULL);
while (save < size_history) {
memset(&history[save++], 0, sizeof(history[0]));
}
}
CTRACE((tfp, "...LYAllocHistory %d vs %d\n", entries, size_history));
}
开发者ID:ezc,项目名称:lynx,代码行数:26,代码来源:LYHistory.c
示例8: ARGS6
/* Define a presentation system command for a content-type
** -------------------------------------------------------
*/
PUBLIC void HTSetPresentation ARGS6(
HTList *, conversions,
CONST char *, representation,
CONST char *, command,
float, quality,
float, secs,
float, secs_per_byte
){
HTPresentation * pres = (HTPresentation *)malloc(sizeof(HTPresentation));
if (pres == NULL) outofmem(__FILE__, "HTSetPresentation");
pres->rep = HTAtom_for(representation);
pres->rep_out = WWW_PRESENT; /* Fixed for now ... :-) */
pres->converter = HTSaveAndExecute; /* Fixed for now ... */
pres->quality = quality;
pres->secs = secs;
pres->secs_per_byte = secs_per_byte;
pres->rep = HTAtom_for(representation);
pres->command = 0;
StrAllocCopy(pres->command, command);
/* if (!HTPresentations) HTPresentations = HTList_new(); */
#ifdef OLD_CODE
if (strcmp(representation, "*")==0) {
if (default_presentation) free(default_presentation);
default_presentation = pres;
} else
#endif
HTList_addObject(conversions, pres);
}
开发者ID:kotohvost,项目名称:yui,代码行数:35,代码来源:HTFormat.c
示例9: ARGS4
/* Define the representation associated with a file suffix
** -------------------------------------------------------
**
** Calling this with suffix set to "*" will set the default
** representation.
** Calling this with suffix set to "*.*" will set the default
** representation for unknown suffix files which contain a ".".
*/
PUBLIC void HTSetSuffix ARGS4(
WWW_CONST char *, suffix,
WWW_CONST char *, representation,
WWW_CONST char *, encoding,
float, value)
{
HTSuffix * suff;
if (strcmp(suffix, "*")==0) suff = &no_suffix;
else if (strcmp(suffix, "*.*")==0) suff = &unknown_suffix;
else {
suff = (HTSuffix*) calloc(1, sizeof(HTSuffix));
if (suff == NULL) outofmem(__FILE__, "HTSetSuffix");
if (!HTSuffixes) HTSuffixes = HTList_new();
HTList_addObject(HTSuffixes, suff);
StrAllocCopy(suff->suffix, suffix);
}
suff->rep = HTAtom_for(representation);
{
char *enc = NULL, *p;
StrAllocCopy(enc, encoding);
for (p=enc; *p; p++) *p = TOLOWER(*p);
suff->encoding = HTAtom_for(enc);
free (enc);
}
suff->quality = value;
}
开发者ID:thentenaar,项目名称:mosaic-ng,代码行数:41,代码来源:HTFile.c
示例10: ARGS1
/* PUBLIC HTAA_encryptPasswd()
** ENCRYPT PASSWORD TO THE FORM THAT IT IS SAVED
** IN THE PASSWORD FILE.
** ON ENTRY:
** password is a string of arbitrary lenght.
**
** ON EXIT:
** returns password in one-way encrypted form.
**
** NOTE:
** Uses currently the C library function crypt(), which
** only accepts at most 8 characters long strings and produces
** always 13 characters long strings. This function is
** called repeatedly so that longer strings can be encrypted.
** This is of course not as safe as encrypting the entire
** string at once, but then again, we are not that paranoid
** about the security inside the machine.
**
*/
PUBLIC char *HTAA_encryptPasswd ARGS1(CONST char *, password)
{
char salt[3];
char chunk[9];
char *result;
char *tmp;
CONST char *cur = password;
int len = strlen(password);
extern time_t theTime;
int random = (int)theTime; /* This is random enough */
if (!(result = (char*)malloc(13*((strlen(password)+7)/8) + 1)))
outofmem(__FILE__, "HTAA_encryptPasswd");
*result = (char)0;
while (len > 0) {
salt[0] = salt_chars[random%64];
salt[1] = salt_chars[(random/64)%64];
salt[2] = (char)0;
strncpy(chunk, cur, 8);
chunk[8] = (char)0;
tmp = crypt((char*)password, salt); /*crypt() doesn't change its args*/
strcat(result, tmp);
cur += 8;
len -= 8;
} /* while */
return result;
}
开发者ID:Hiroyuki-Nagata,项目名称:libwww,代码行数:51,代码来源:HTPasswd.c
示例11: ARGS7
/* Define a built-in function for a content-type
** ---------------------------------------------
*/
PUBLIC void HTSetConversion ARGS7(
HTList *, conversions,
CONST char *, representation_in,
CONST char *, representation_out,
HTConverter*, converter,
float, quality,
float, secs,
float, secs_per_byte
){
HTPresentation * pres = (HTPresentation *)malloc(sizeof(HTPresentation));
if (pres == NULL) outofmem(__FILE__, "HTSetPresentation");
pres->rep = HTAtom_for(representation_in);
pres->rep_out = HTAtom_for(representation_out);
pres->converter = converter;
pres->command = NULL; /* Fixed */
pres->quality = quality;
pres->secs = secs;
pres->secs_per_byte = secs_per_byte;
pres->command = 0;
/* if (!HTPresentations) HTPresentations = HTList_new(); */
#ifdef OLD_CODE
if (strcmp(representation_in, "*")==0) {
if (default_presentation) free(default_presentation);
default_presentation = pres;
} else
#endif
HTList_addObject(conversions, pres);
}
开发者ID:kotohvost,项目名称:yui,代码行数:35,代码来源:HTFormat.c
示例12: HTAA_setupReader
/* PUBLIC HTAA_setupReader()
* SET UP HEADER LINE READER, i.e., give
* the already-read-but-not-yet-processed
* buffer of text to be read before more
* is read from the socket.
* ON ENTRY:
* start_of_headers is a pointer to a buffer containing
* the beginning of the header lines
* (rest will be read from a socket).
* length is the number of valid characters in
* 'start_of_headers' buffer.
* soc is the socket to use when start_of_headers
* buffer is used up.
* ON EXIT:
* returns nothing.
* Subsequent calls to HTAA_getUnfoldedLine()
* will use this buffer first and then
* proceed to read from socket.
*/
void HTAA_setupReader(char *start_of_headers,
size_t length,
int soc)
{
if (!start_of_headers)
length = 0; /* initialize length (is this reached at all?) */
if (buffer == NULL) { /* first call? */
buffer_length = length;
if (buffer_length < BUFFER_SIZE) /* would fall below BUFFER_SIZE? */
buffer_length = BUFFER_SIZE;
buffer = (char *) malloc((size_t) (sizeof(char) * (buffer_length + 1)));
} else if (length > buffer_length) { /* need more space? */
buffer_length = length;
buffer = (char *) realloc((char *) buffer,
(size_t) (sizeof(char) * (buffer_length + 1)));
}
if (buffer == NULL)
outofmem(__FILE__, "HTAA_setupReader");
#ifdef LY_FIND_LEAKS
atexit(FreeHTAAUtil);
#endif
start_pointer = buffer;
if (start_of_headers) {
LYStrNCpy(buffer, start_of_headers, length);
end_pointer = buffer + length;
} else {
*start_pointer = '\0';
end_pointer = start_pointer;
}
in_soc = soc;
}
开发者ID:ThomasDickey,项目名称:lynx-snapshots,代码行数:51,代码来源:HTAAUtil.c
示例13: ARGS2
/* PUBLIC HTVMS_name()
** CONVERTS WWW name into a VMS name
** ON ENTRY:
** nn Node Name (optional)
** fn WWW file name
**
** ON EXIT:
** returns vms file specification
**
** Bug: Returns pointer to static -- non-reentrant
*/
PUBLIC char * HTVMS_name ARGS2(
CONST char *, nn,
CONST char *, fn)
{
/* We try converting the filename into Files-11 syntax. That is, we assume
** first that the file is, like us, on a VMS node. We try remote
** (or local) DECnet access. Files-11, VMS, VAX and DECnet
** are trademarks of Digital Equipment Corporation.
** The node is assumed to be local if the hostname WITHOUT DOMAIN
** matches the local one. @@@
*/
static char vmsname[INFINITY]; /* returned */
char * filename = (char*)malloc(strlen(fn)+1);
char * nodename = (char*)malloc(strlen(nn)+2+1); /* Copies to hack */
char *second; /* 2nd slash */
char *last; /* last slash */
char * hostname = HTHostName();
if (!filename || !nodename) outofmem(__FILE__, "HTVMSname");
strcpy(filename, fn);
strcpy(nodename, ""); /* On same node? Yes if node names match */
if (strncmp(nn,"localhost",9)) {
char *p, *q;
for (p=hostname, q=nn; *p && *p!='.' && *q && *q!='.'; p++, q++){
if (TOUPPER(*p)!=TOUPPER(*q)) {
strcpy(nodename, nn);
q = strchr(nodename, '.'); /* Mismatch */
if (q) *q=0; /* Chop domain */
strcat(nodename, "::"); /* Try decnet anyway */
break;
}
}
}
second = strchr(filename+1, '/'); /* 2nd slash */
last = strrchr(filename, '/'); /* last slash */
if (!second) { /* Only one slash */
sprintf(vmsname, "%s%s", nodename, filename + 1);
} else if(second==last) { /* Exactly two slashes */
*second = 0; /* Split filename from disk */
sprintf(vmsname, "%s%s:%s", nodename, filename+1, second+1);
*second = '/'; /* restore */
} else { /* More than two slashes */
char * p;
*second = 0; /* Split disk from directories */
*last = 0; /* Split dir from filename */
sprintf(vmsname, "%s%s:[%s]%s",
nodename, filename+1, second+1, last+1);
*second = *last = '/'; /* restore filename */
for (p=strchr(vmsname, '['); *p!=']'; p++)
if (*p=='/') *p='.'; /* Convert dir sep. to dots */
}
free(nodename);
free(filename);
return vmsname;
}
开发者ID:unusual-thoughts,项目名称:freebsd-1.x-ports,代码行数:70,代码来源:HTVMSUtils.c
示例14: ARGS2
PUBLIC char * HTSACat
ARGS2 (char **,dest, CONST char *,src)
{
if (src && *src) {
if (*dest) {
int length = strlen (*dest);
*dest = (char *) realloc (*dest, length + strlen(src) + 1);
if (*dest == NULL) outofmem(__FILE__, "HTSACat");
strcpy (*dest + length, src);
} else {
*dest = (char *) malloc (strlen(src) + 1);
if (*dest == NULL) outofmem(__FILE__, "HTSACat");
strcpy (*dest, src);
}
}
return *dest;
}
开发者ID:csev,项目名称:xmosaic-1.2,代码行数:17,代码来源:HTString.c
示例15: typecalloc
HTStyleSheet *HTStyleSheetNew(void)
{
HTStyleSheet *self = typecalloc(HTStyleSheet);
if (self == NULL)
outofmem(__FILE__, "HTStyleSheetNew");
return self;
}
开发者ID:AaronDP,项目名称:lynx_adbshell,代码行数:8,代码来源:HTStyle.c
示例16: ARGS3
PUBLIC int HTAddRule ARGS3(HTRuleOp, op,
CONST char *, pattern,
CONST char *, equiv)
{ /* BYTE_ADDRESSING removed and memory check - AS - 1 Sep 93 */
rule * temp;
char * pPattern;
temp = (rule *)malloc(sizeof(*temp));
if (temp==NULL)
outofmem(__FILE__, "HTAddRule");
pPattern = (char *)malloc(strlen(pattern)+1);
if (pPattern==NULL)
outofmem(__FILE__, "HTAddRule");
if (equiv) { /* Two operands */
char * pEquiv = (char *)malloc(strlen(equiv)+1);
if (pEquiv==NULL)
outofmem(__FILE__, "HTAddRule");
temp->equiv = pEquiv;
strcpy(pEquiv, equiv);
} else {
temp->equiv = 0;
}
temp->pattern = pPattern;
temp->op = op;
strcpy(pPattern, pattern);
if (TRACE) {
if (equiv)
fprintf(stderr, "Rule: For `%s' op %d `%s'\n", pattern, op, equiv);
else
fprintf(stderr, "Rule: For `%s' op %d\n", pattern, op);
}
#ifdef PUT_ON_HEAD
temp->next = rules;
rules = temp;
#else
temp->next = 0;
if (rule_tail) rule_tail->next = temp;
else rules = temp;
rule_tail = temp;
#endif
return 0;
}
开发者ID:kotohvost,项目名称:yui,代码行数:46,代码来源:HTRules.c
示例17: outofmem
inline RegExpNode *Re::allocnode()
{
RegExpNode *n;
if ((n=new RegExpNode(nextid++)) == 0)
outofmem();
n->next=nodes; nodes=n; return(n);
}
开发者ID:debdungeon,项目名称:qint,代码行数:8,代码来源:re.C
示例18: ARGS2
/* Output parent directory entry
**
** This gives the TITLE and H1 header, and also a link
** to the parent directory if appropriate.
*/
PUBLIC void HTDirTitles ARGS2(HTStructured *, target,
HTAnchor * , anchor)
{
char * logical = HTAnchor_address(anchor);
char * path = HTParse(logical, "", PARSE_PATH + PARSE_PUNCTUATION);
char * current;
current = strrchr(path, '/'); /* last part or "" */
free(logical);
{
char * printable = NULL;
StrAllocCopy(printable, (current + 1));
HTUnEscape(printable);
START(HTML_TITLE);
PUTS(*printable ? printable : "Welcome ");
PUTS(" directory");
END(HTML_TITLE);
START(HTML_H1);
PUTS(*printable ? printable : "Welcome");
END(HTML_H1);
free(printable);
}
/* Make link back to parent directory
*/
if (current && current[1]) { /* was a slash AND something else too */
char * parent;
char * relative;
*current++ = 0;
parent = strrchr(path, '/'); /* penultimate slash */
relative = (char*) malloc(strlen(current) + 4);
if (relative == NULL) outofmem(__FILE__, "DirRead");
sprintf(relative, "%s/..", current);
PUTS ("<A HREF=\"");
PUTS (relative);
PUTS ("\">");
free(relative);
PUTS("Up to ");
if (parent) {
char * printable = NULL;
StrAllocCopy(printable, parent + 1);
HTUnEscape(printable);
PUTS(printable);
free(printable);
} else {
PUTS("/");
}
PUTS("</A>");
}
free(path);
}
开发者ID:thentenaar,项目名称:mosaic-ng,代码行数:63,代码来源:HTFile.c
示例19: ARGS2
/* Tee creation
*/
PUBLIC HTStream * HTTee ARGS2(HTStream *, s1,HTStream *, s2)
{
HTStream * me = (HTStream*)malloc(sizeof(*me));
if (!me) outofmem(__FILE__, "HTTee");
me->isa = &HTTeeClass;
me->s1 = s1;
me->s2 = s2;
return me;
}
开发者ID:tjgillies,项目名称:cern-httpd,代码行数:11,代码来源:HTTee.c
示例20: HTAddRule
int HTAddRule(HTRuleOp op, const char *pattern,
const char *equiv,
const char *cond_op,
const char *cond)
{ /* BYTE_ADDRESSING removed and memory check - AS - 1 Sep 93 */
rule *temp;
char *pPattern = NULL;
temp = typecalloc(rule);
if (temp == NULL)
outofmem(__FILE__, "HTAddRule");
if (equiv) { /* Two operands */
char *pEquiv = NULL;
StrAllocCopy(pEquiv, equiv);
temp->equiv = pEquiv;
} else {
temp->equiv = 0;
}
if (cond_op) {
StrAllocCopy(temp->condition_op, cond_op);
StrAllocCopy(temp->condition, cond);
}
StrAllocCopy(pPattern, pattern);
temp->pattern = pPattern;
temp->op = op;
if (equiv) {
CTRACE((tfp, "Rule: For `%s' op %d `%s'", pattern, op, equiv));
} else {
CTRACE((tfp, "Rule: For `%s' op %d", pattern, op));
}
if (cond_op) {
CTRACE((tfp, "\t%s %s\n", cond_op, NONNULL(cond)));
} else {
CTRACE((tfp, "\n"));
}
if (!rules) {
#ifdef LY_FIND_LEAKS
atexit(HTClearRules);
#endif
}
#ifdef PUT_ON_HEAD
temp->next = rules;
rules = temp;
#else
temp->next = 0;
if (rule_tail)
rule_tail->next = temp;
else
rules = temp;
rule_tail = temp;
#endif
return 0;
}
开发者ID:avsm,项目名称:openbsd-lynx-working,代码行数:57,代码来源:HTRules.c
注:本文中的outofmem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论