本文整理汇总了C++中ealloc函数的典型用法代码示例。如果您正苦于以下问题:C++ ealloc函数的具体用法?C++ ealloc怎么用?C++ ealloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ealloc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ktest_make_sample_etype_info2
void
ktest_make_sample_etype_info2(krb5_etype_info_entry ***p)
{
krb5_etype_info_entry **info;
int i, len;
char *str;
info = ealloc(4 * sizeof(krb5_etype_info_entry *));
for (i = 0; i < 3; i++) {
info[i] = ealloc(sizeof(krb5_etype_info_entry));
info[i]->etype = i;
len = asprintf(&str, "Morton's #%d", i);
if (len < 0)
abort();
info[i]->salt = (krb5_octet *)str;
info[i]->length = (unsigned int)len;
len = asprintf(&info[i]->s2kparams.data, "s2k: %d", i);
if (len < 0)
abort();
info[i]->s2kparams.length = (unsigned int) len;
info[i]->magic = KV5M_ETYPE_INFO_ENTRY;
}
free(info[1]->salt);
info[1]->length = KRB5_ETYPE_NO_SALT;
info[1]->salt = 0;
*p = info;
}
示例2: add_edge
void add_edge (int a, int b)
{
edge* e1 = ealloc ();
e1->a = a, e1->b = b, e1->next = ve[a], ve[a] = e1;
edge* e2 = ealloc ();
e2->a = b, e2->b = a, e2->next = ve[b], ve[b] = e2;
e1->back = e2, e2->back = e1;
}
示例3: add_edge
edge* add_edge (int a, int b, int i)
{
edge* e = ealloc ();
e->a = a, e->b = b, e->ok = true, e->next = ve[a], ve[a] = e, e->i = i;
edge* e2 = ealloc ();
e2->a = b, e2->b = a, e2->ok = true, e2->next = ve[b], ve[b] = e2, e2->i = i;
e->back = e2, e2->back = e;
}
示例4: add_edge
edge* add_edge (int a, int b, int p)
{
edge* e = ealloc ();
e->b = b, e->p = p, e->f = 0, e->next = ve[a], ve[a] = e;
edge* e2 = ealloc ();
b, e2->b = a, e2->p = 0, e2->f = 0, e2->next = ve[b], ve[b] = e2;
e->back = e2, e2->back = e;
}
示例5: add_edge
edge* add_edge (int a, int b, int c)
{
edge* e = ealloc ();
e->a = a, e->b = b, e->c = c, e->next = ve[a], ve[a] = e;
edge* e2 = ealloc ();
e2->a = b, e2->b = a, e2->c = c, e2->next = ve[b], ve[b] = e2;
e->back = e2, e2->back = e;
}
示例6: ktest_make_sample_fast_response
void
ktest_make_sample_fast_response(krb5_fast_response *p)
{
ktest_make_sample_pa_data_array(&p->padata);
p->strengthen_key = ealloc(sizeof(krb5_keyblock));
ktest_make_sample_keyblock(p->strengthen_key);
p->finished = ealloc(sizeof(krb5_fast_finished));
ktest_make_sample_fast_finished(p->finished);
p->nonce = SAMPLE_NONCE;
}
示例7: ktest_make_minimal_pa_otp_challenge
void
ktest_make_minimal_pa_otp_challenge(krb5_pa_otp_challenge *p)
{
memset(p, 0, sizeof(*p));
krb5_data_parse(&p->nonce, "minnonce");
p->tokeninfo = ealloc(2 * sizeof(*p->tokeninfo));
p->tokeninfo[0] = ealloc(sizeof(*p->tokeninfo[0]));
ktest_make_minimal_otp_tokeninfo(p->tokeninfo[0]);
p->tokeninfo[1] = NULL;
}
示例8: geteuid
extern char *which(char *name, bool verbose) {
static char *test = NULL;
static size_t testlen = 0;
List *path;
int len;
if (name == NULL) /* no filename? can happen with "> foo" as a command */
return NULL;
if (!initialized) {
initialized = TRUE;
uid = geteuid();
gid = getegid();
#if HAVE_GETGROUPS
#if HAVE_POSIX_GETGROUPS
ngroups = getgroups(0, (GETGROUPS_T *)0);
if (ngroups < 0) {
uerror("getgroups");
rc_exit(1);
}
#else
ngroups = NGROUPS;
#endif
if (ngroups) {
gidset = ealloc(ngroups * sizeof(GETGROUPS_T));
getgroups(ngroups, gidset);
}
#endif
}
if (isabsolute(name)) /* absolute pathname? */
return rc_access(name, verbose) ? name : NULL;
len = strlen(name);
for (path = varlookup("path"); path != NULL; path = path->n) {
size_t need = strlen(path->w) + len + 2; /* one for null terminator, one for the '/' */
if (testlen < need) {
efree(test);
test = ealloc(testlen = need);
}
if (*path->w == '\0') {
strcpy(test, name);
} else {
strcpy(test, path->w);
if (!streq(test, "/")) /* "//" is special to POSIX */
strcat(test, "/");
strcat(test, name);
}
if (rc_access(test, FALSE))
return test;
}
if (verbose) {
char *n = protect(name);
fprint(2, RC "cannot find `%s'\n", n);
efree(n);
}
return NULL;
}
示例9: ktest_make_sample_sam_challenge_2
void
ktest_make_sample_sam_challenge_2(krb5_sam_challenge_2 *p)
{
/* Need a valid DER sequence encoding here; this one contains the OCTET
* STRING "challenge". */
krb5_data_parse(&p->sam_challenge_2_body, "\x30\x0B\x04\x09" "challenge");
p->sam_cksum = ealloc(2 * sizeof(krb5_checksum *));
p->sam_cksum[0] = ealloc(sizeof(krb5_checksum));
ktest_make_sample_checksum(p->sam_cksum[0]);
p->sam_cksum[1] = NULL;
}
示例10: ktest_make_sample_pa_data_array
void
ktest_make_sample_pa_data_array(krb5_pa_data ***pad)
{
int i;
*pad = ealloc(3 * sizeof(krb5_pa_data *));
for (i = 0; i <= 1; i++) {
(*pad)[i] = ealloc(sizeof(krb5_pa_data));
ktest_make_sample_pa_data((*pad)[i]);
}
(*pad)[2] = NULL;
}
示例11: ktest_make_sample_authorization_data
void
ktest_make_sample_authorization_data(krb5_authdata ***ad)
{
int i;
*ad = ealloc(3 * sizeof(krb5_authdata *));
for (i = 0; i <= 1; i++) {
(*ad)[i] = ealloc(sizeof(krb5_authdata));
ktest_make_sample_authdata((*ad)[i]);
}
(*ad)[2] = NULL;
}
示例12: ktest_make_sample_addresses
void
ktest_make_sample_addresses(krb5_address ***caddrs)
{
int i;
*caddrs = ealloc(3 * sizeof(krb5_address *));
for (i = 0; i < 2; i++) {
(*caddrs)[i] = ealloc(sizeof(krb5_address));
ktest_make_sample_address((*caddrs)[i]);
}
(*caddrs)[2] = NULL;
}
示例13: inityy
extern void inityy() {
newline = FALSE;
w = NW;
hq = NULL;
/* return memory to the system if the buffer got too large */
if (bufsize > BUFMAX && realbuf != NULL) {
efree(realbuf);
bufsize = BUFSIZE;
realbuf = ealloc(bufsize);
} else if (realbuf == NULL)
realbuf = ealloc(bufsize);
}
示例14: ktest_make_sample_priv_enc_part
void
ktest_make_sample_priv_enc_part(krb5_priv_enc_part *pep)
{
ktest_make_sample_data(&(pep->user_data));
pep->timestamp = SAMPLE_TIME;
pep->usec = SAMPLE_USEC;
pep->seq_number = SAMPLE_SEQ_NUMBER;
pep->s_address = ealloc(sizeof(krb5_address));
ktest_make_sample_address(pep->s_address);
pep->r_address = ealloc(sizeof(krb5_address));
ktest_make_sample_address(pep->r_address);
}
示例15: ktest_make_sample_sequence_of_ticket
void
ktest_make_sample_sequence_of_ticket(krb5_ticket ***sot)
{
int i;
*sot = ealloc(3 * sizeof(krb5_ticket *));
for (i = 0; i < 2; i++) {
(*sot)[i] = ealloc(sizeof(krb5_ticket));
ktest_make_sample_ticket((*sot)[i]);
}
(*sot)[2] = NULL;
}