本文整理汇总了C++中dmalloc函数的典型用法代码示例。如果您正苦于以下问题:C++ dmalloc函数的具体用法?C++ dmalloc怎么用?C++ dmalloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dmalloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: osd_setWorkingDirectory
static void osd_setWorkingDirectory (void)
{
# if defined (UNIX)
char *buf = dmalloc (sizeof (*buf) * MAXPATHLEN);
char *cwd = getcwd (buf, MAXPATHLEN);
#elif defined (OS2)
char *buf = dmalloc (sizeof (*buf) * MAXPATHLEN);
char *cwd = _getcwd2 (buf, MAXPATHLEN);
char *slash;
while ((slash = strchr (cwd, '/')) != NULL)
{
*slash = '\\';
}
#endif
# if defined (UNIX) || defined (OS2)
llassert (cstring_isUndefined (osd_cwd));
if (cwd == NULL)
{
lldiagmsg (message ("Cannot get working directory: %s\n",
lldecodeerror (errno)));
osd_cwd = cstring_makeLiteral ("<missing directory>");
}
else
{
osd_cwd = cstring_fromCharsNew (cwd);
}
sfree (buf);
# else
; /* Don't know how to do this for non-POSIX platforms */
# endif
}
开发者ID:DanielTillett,项目名称:splint,代码行数:33,代码来源:osd.c
示例2: uentryList_copy
uentryList uentryList_copy (uentryList s)
{
if (uentryList_isDefined (s))
{
uentryList t = (uentryList) dmalloc (sizeof (*t));
int i;
t->nelements = s->nelements;
t->nspace = 0;
t->current = s->current;
if (s->nelements > 0)
{
t->elements = (uentry *) dmalloc (sizeof (*t->elements) * t->nelements);
for (i = 0; i < s->nelements; i++)
{
t->elements[i] = uentry_copy (s->elements[i]);
}
}
else
{
t->elements = NULL;
}
return t;
}
else
{
return uentryList_undefined;
}
}
开发者ID:DanielTillett,项目名称:splint,代码行数:32,代码来源:uentryList.c
示例3: strlen
struct String *string_new(char* str) {
struct String* newString = (struct String*)dmalloc(sizeof(struct String));
newString->len = strlen(str);
newString->cap = newString->len == 0 ? 1 : newString->len;
newString->str = (char*)dmalloc(newString->cap + 1);
strcpy(newString->str, str);
return newString;
}
开发者ID:xpycc,项目名称:operating-system-exercises,代码行数:8,代码来源:fast_string.c
示例4: strcpy
struct String *string_clone(struct String* s) {
struct String* newString = (struct String*)dmalloc(sizeof(struct String));
newString->len = s->len;
newString->cap = s->len;
newString->str = (char*)dmalloc(s->len + 1);
strcpy(newString->str, s->str);
return newString;
}
开发者ID:xpycc,项目名称:operating-system-exercises,代码行数:8,代码来源:fast_string.c
示例5: load_uname_pwd_from_miCASA
int
load_uname_pwd_from_miCASA (char **ldap_username, char **ldap_password)
{
int result = 0;
uint32_t credentialtype = SSCS_CRED_TYPE_SERVER_F;
SSCS_BASIC_CREDENTIAL credential;
SSCS_SECRET_ID_T applicationSecretId;
char *tempVar = NULL;
const char applicationName[10] = "dhcp-ldap";
if ( load_casa() )
{
memset(&credential, 0, sizeof(SSCS_BASIC_CREDENTIAL));
memset(&applicationSecretId, 0, sizeof(SSCS_SECRET_ID_T));
applicationSecretId.len = strlen(applicationName) + 1;
memcpy (applicationSecretId.id, applicationName, applicationSecretId.len);
credential.unFlags = USERNAME_TYPE_CN_F;
result = p_miCASAGetCredential (0,
&applicationSecretId,NULL,&credentialtype,
&credential,NULL);
if(credential.unLen)
{
tempVar = dmalloc (credential.unLen + 1, MDL);
if (!tempVar)
log_fatal ("no memory for ldap_username");
memcpy(tempVar , credential.username, credential.unLen);
*ldap_username = tempVar;
tempVar = dmalloc (credential.pwordLen + 1, MDL);
if (!tempVar)
log_fatal ("no memory for ldap_password");
memcpy(tempVar, credential.password, credential.pwordLen);
*ldap_password = tempVar;
#if defined (DEBUG_LDAP)
log_info ("Authentication credential taken from CASA");
#endif
release_casa();
return 1;
}
else
{
release_casa();
return 0;
}
}
else
return 0; //casa libraries not loaded
}
开发者ID:ATNoG,项目名称:ODTONE,代码行数:56,代码来源:ldap_casa.c
示例6: dmalloc
static RegInfo *tf_reg_compile_fl(const char *pattern, int optimize,
const char *file, int line)
{
RegInfo *ri;
const char *emsg, *s;
int eoffset, n;
/* PCRE_DOTALL optimizes patterns starting with ".*" */
int options = PCRE_DOLLAR_ENDONLY | PCRE_DOTALL | PCRE_CASELESS;
ri = dmalloc(NULL, sizeof(RegInfo), file, line);
if (!ri) return NULL;
ri->extra = NULL;
ri->ovector = NULL;
ri->Str = NULL;
ri->links = 1;
if (warn_curly_re && (s = estrchr(pattern, '{', '\\')) &&
(is_digit(s[1]) || s[1] == ','))
{
wprintf("regexp contains '{', which has a new meaning in version 5.0. "
"(This warning can be disabled with '/set warn_curly_re=off'.)");
}
for (s = pattern; *s; s++) {
if (*s == '\\') {
if (s[1]) s++;
} else if (is_upper(*s)) {
options &= ~PCRE_CASELESS;
break;
}
}
ri->re = pcre_compile((char*)pattern, options, &emsg, &eoffset, re_tables);
if (!ri->re) {
/* don't trust emsg to be non-NULL or NUL-terminated */
eprintf("regexp error: character %d: %.128s", eoffset,
emsg ? emsg : "unknown error");
goto tf_reg_compile_error;
}
n = pcre_info(ri->re, NULL, NULL);
if (n < 0) goto tf_reg_compile_error;
ri->ovecsize = 3 * (n + 1);
ri->ovector = dmalloc(NULL, sizeof(int) * ri->ovecsize, file, line);
if (!ri->ovector) goto tf_reg_compile_error;
if (optimize) {
ri->extra = pcre_study(ri->re, 0, &emsg);
if (emsg) {
eprintf("regexp study error: %.128s", emsg);
goto tf_reg_compile_error;
}
}
return ri;
tf_reg_compile_error:
tf_reg_free(ri);
return NULL;
}
开发者ID:Sketch,项目名称:tinyfugue,代码行数:56,代码来源:pattern.c
示例7: sortSet_new
sortSet sortSet_new ()
{
sortSet s = (sortSet) dmalloc (sizeof (*s));
s->entries = 0;
s->nspace = sortSetBASESIZE;
s->elements = (sort *) dmalloc (sizeof (*s->elements) * sortSetBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:10,代码来源:sortSet.c
示例8: mtMergeClauseList_newEmpty
static /*@[email protected]*/ mtMergeClauseList
mtMergeClauseList_newEmpty (void)
{
mtMergeClauseList s = (mtMergeClauseList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = mtMergeClauseListBASESIZE;
s->elements = (mtMergeClause *) dmalloc (sizeof (*s->elements) * mtMergeClauseListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:11,代码来源:mtMergeClauseList.c
示例9: cstringList_newPredict
static /*@[email protected]*/ cstringList
cstringList_newPredict (int size)
{
cstringList s = (cstringList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = size;
s->elements = (cstring *) dmalloc (sizeof (*s->elements) * size);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:11,代码来源:cstringList.c
示例10: cstringList_newEmpty
static /*@[email protected]*/ cstringList
cstringList_newEmpty (void)
{
cstringList s = (cstringList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = cstringListBASESIZE;
s->elements = (cstring *) dmalloc (sizeof (*s->elements) * cstringListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:11,代码来源:cstringList.c
示例11: qualList_newEmpty
static /*@[email protected]*/ /*@[email protected]*/ qualList
qualList_newEmpty (void)
{
qualList s = (qualList) dmalloc (sizeof (*s));
s->nelements = 0;
s->free = qualListBASESIZE;
s->elements = (qual *) dmalloc (sizeof (*s->elements) * qualListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:11,代码来源:qualList.c
示例12: dmalloc
/*@[email protected]*/ constraintList constraintList_makeNew ()
{
constraintList s = (constraintList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = constraintListBASESIZE;
s->elements = (constraint *)
dmalloc (sizeof (*s->elements) * constraintListBASESIZE);
return (s);
}
开发者ID:OS2World,项目名称:DEV-C-UTIL-Splint,代码行数:11,代码来源:constraintList.c
示例13: sRefList_newEmpty
static /*@[email protected]*/ /*@[email protected]*/ sRefList
sRefList_newEmpty (void)
{
sRefList s = (sRefList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = sRefListBASESIZE;
s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:11,代码来源:sRefList.c
示例14: varDeclarationNodeList_new
varDeclarationNodeList varDeclarationNodeList_new ()
{
varDeclarationNodeList s = (varDeclarationNodeList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = varDeclarationNodeListBASESIZE;
s->elements = (varDeclarationNode *)
dmalloc (sizeof (*s->elements) * varDeclarationNodeListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:11,代码来源:varDeclarationNodeList.c
示例15: paramNodeList_single
/*@[email protected]*/ paramNodeList
paramNodeList_single (/*@[email protected]*/ paramNode p)
{
paramNodeList s = (paramNodeList) dmalloc (sizeof (*s));
s->nelements = 1;
s->nspace = paramNodeListBASESIZE - 1;
s->elements = (paramNode *) dmalloc (sizeof (*s->elements) * paramNodeListBASESIZE);
s->elements[0] = p;
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:12,代码来源:paramNodeList.c
示例16: paramNodeList_new
/*@[email protected]*/ paramNodeList
paramNodeList_new ()
{
paramNodeList s = (paramNodeList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = paramNodeListBASESIZE;
s->elements = (paramNode *)
dmalloc (sizeof (*s->elements) * paramNodeListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:12,代码来源:paramNodeList.c
示例17: sRefSet_single
/*@[email protected]*/ sRefSet
sRefSet_single (/*@[email protected]*/ sRef sr)
{
sRefSet s = (sRefSet) dmalloc (sizeof (*s));
s->entries = 1;
s->nspace = sRefSetBASESIZE - 1;
s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefSetBASESIZE);
s->elements[0] = sr;
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:12,代码来源:sRefSet.c
示例18: declaratorNodeList_new
declaratorNodeList
declaratorNodeList_new ()
{
declaratorNodeList s = (declaratorNodeList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = declaratorNodeListBASESIZE;
s->elements = (declaratorNode *)
dmalloc (sizeof (*s->elements) * declaratorNodeListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:12,代码来源:declaratorNodeList.c
示例19: traitRefNodeList_new
/*@[email protected]*/ traitRefNodeList
traitRefNodeList_new ()
{
traitRefNodeList s = (traitRefNodeList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = traitRefNodeListBASESIZE;
s->elements = (traitRefNode *)
dmalloc (sizeof (*s->elements) * traitRefNodeListBASESIZE);
return (s);
}
开发者ID:josephwinston,项目名称:themis,代码行数:12,代码来源:traitRefNodeList.c
示例20: quantifierNodeList_new
/*@[email protected]*/ quantifierNodeList
quantifierNodeList_new ()
{
quantifierNodeList s = (quantifierNodeList) dmalloc (sizeof (*s));
s->nelements = 0;
s->nspace = quantifierNodeListBASESIZE;
s->elements = (quantifierNode *)
dmalloc (sizeof (*s->elements) * quantifierNodeListBASESIZE);
return (s);
}
开发者ID:DanielTillett,项目名称:splint,代码行数:12,代码来源:quantifierNodeList.c
注:本文中的dmalloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论