这篇教程C++ talloc_asprintf_append函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中talloc_asprintf_append函数的典型用法代码示例。如果您正苦于以下问题:C++ talloc_asprintf_append函数的具体用法?C++ talloc_asprintf_append怎么用?C++ talloc_asprintf_append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了talloc_asprintf_append函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dsdb_subSchema_attributeTypesWERROR dsdb_subSchema_attributeTypes(const struct dsdb_schema *schema, TALLOC_CTX *mem_ctx){ struct ldb_message_element *e; struct dsdb_attribute *a; e = talloc_zero(mem_ctx, struct ldb_message_element); W_ERROR_HAVE_NO_MEMORY(e); for (a = schema->attributes; a; a = a->next) { char *v; v = talloc_asprintf(e, "( %s NAME '%s' SYNTAX '%s' ", a->attributeID_oid, a->lDAPDisplayName, a->syntax->ldap_oid); W_ERROR_HAVE_NO_MEMORY(v); if (a->isSingleValued) { v = talloc_asprintf_append(v, "SINGLE-VALUE "); W_ERROR_HAVE_NO_MEMORY(v); } if (a->systemOnly) { v = talloc_asprintf_append(v, "NO-USER-MODIFICATION "); W_ERROR_HAVE_NO_MEMORY(v); } v = talloc_asprintf_append(v, ")"); W_ERROR_HAVE_NO_MEMORY(v); DEBUG(0,("%s/n", v)); } return WERR_FOOBAR;}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:35,
示例2: talloc_asprintf_appendstatic char *dsdb_subSchema_list_append(char *v, const char *list_name){ bool first = true; uint32_t i; const char *attrs[] = { "attr1", "attr2", "attr3", NULL }; if (!attrs) { return v; } v = talloc_asprintf_append(v, "%s ( ", list_name); if (!v) return NULL; for (i=0; attrs[i]; i++) { v = talloc_asprintf_append(v, "%s%s ", (!first ? "$ " : ""), attrs[i]); if (!v) return NULL; first = false; } v = talloc_asprintf_append(v, ") "); if (!v) return NULL; return v;}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:31,
示例3: talloc_asprintfstatic char *wbinfo_prompt_pass(const char *prefix, const char *username){ char *prompt; const char *ret = NULL; prompt = talloc_asprintf(talloc_tos(), "Enter %s's ", username); if (!prompt) { return NULL; } if (prefix) { prompt = talloc_asprintf_append(prompt, "%s ", prefix); if (!prompt) { return NULL; } } prompt = talloc_asprintf_append(prompt, "password: "); if (!prompt) { return NULL; } ret = getpass(prompt); TALLOC_FREE(prompt); return SMB_STRDUP(ret);}
开发者ID:gojdic,项目名称:samba,代码行数:26,
示例4: talloc_asprintf/** * Return a human-readable description of all talloc memory usage. * The result is allocated from @p t. **/char *talloc_describe_all(TALLOC_CTX *rt){ int n_pools = 0, total_chunks = 0; size_t total_bytes = 0; TALLOC_CTX *it; char *s; if (!rt) return NULL; s = talloc_asprintf(rt, "global talloc allocations in pid: %u/n", (unsigned) sys_getpid()); s = talloc_asprintf_append(rt, s, "%-40s %8s %8s/n", "name", "chunks", "bytes"); s = talloc_asprintf_append(rt, s, "%-40s %8s %8s/n", "----------------------------------------", "--------", "--------"); for (it = list_head; it; it = it->next_ctx) { size_t bytes; int n_chunks; fstring what; n_pools++; talloc_get_allocation(it, &bytes, &n_chunks); if (it->name) fstrcpy(what, it->name); else slprintf(what, sizeof what, "@%p", it); s = talloc_asprintf_append(rt, s, "%-40s %8u %8u/n", what, (unsigned) n_chunks, (unsigned) bytes); total_bytes += bytes; total_chunks += n_chunks; } s = talloc_asprintf_append(rt, s, "%-40s %8s %8s/n", "----------------------------------------", "--------", "--------"); s = talloc_asprintf_append(rt, s, "%-40s %8u %8u/n", "TOTAL", (unsigned) total_chunks, (unsigned) total_bytes); return s;}
开发者ID:jophxy,项目名称:samba,代码行数:55,
示例5: sql_init_socket/************************************************************************* * * Function: sql_create_socket * * Purpose: Establish connection to the db * *************************************************************************/static int sql_init_socket(rlm_sql_handle_t *handle, rlm_sql_config_t *config) { char *dbstring; rlm_sql_postgres_conn_t *conn;#ifdef HAVE_OPENSSL_CRYPTO_H static bool ssl_init = false; if (!ssl_init) { PQinitOpenSSL(0, 0); ssl_init = true; }#endif MEM(conn = handle->conn = talloc_zero(handle, rlm_sql_postgres_conn_t)); talloc_set_destructor(conn, _sql_socket_destructor); dbstring = strchr(config->sql_db, '=') ? talloc_strdup(conn, config->sql_db) : talloc_asprintf(conn, "dbname='%s'", config->sql_db); if (config->sql_server[0] != '/0') { dbstring = talloc_asprintf_append(dbstring, " host='%s'", config->sql_server); } if (config->sql_port[0] != '/0') { dbstring = talloc_asprintf_append(dbstring, " port=%s", config->sql_port); } if (config->sql_login[0] != '/0') { dbstring = talloc_asprintf_append(dbstring, " user='%s'", config->sql_login); } if (config->sql_password[0] != '/0') { dbstring = talloc_asprintf_append(dbstring, " password='%s'", config->sql_password); } conn->dbstring = dbstring; conn->db = PQconnectdb(dbstring); DEBUG2("rlm_sql_postgresql: Connecting using parameters: %s", dbstring); if (!conn->db || (PQstatus(conn->db) != CONNECTION_OK)) { ERROR("rlm_sql_postgresql: Connection failed: %s", PQerrorMessage(conn->db)); return -1; } DEBUG2("Connected to database '%s' on '%s' server version %i, protocol version %i, backend PID %i ", PQdb(conn->db), PQhost(conn->db), PQserverVersion(conn->db), PQprotocolVersion(conn->db), PQbackendPID(conn->db)); return 0;}
开发者ID:AlainRomeyer,项目名称:freeradius-server,代码行数:56,
示例6: invalid/** /details Get FMID by mapistore URI. /param ictx valid pointer to indexing context /param username samAccountName for current user /param uri mapistore URI or pattern to search for /param partia if true, uri is pattern to search for /param fmidp pointer to valid location to store found FMID /param soft_deletedp Pointer to bool var to return Soft Deleted state /return MAPISTORE_SUCCESS on success MAPISTORE_ERR_NOT_FOUND if uri does not exists in DB MAPISTORE_ERR_NOT_INITIALIZED if ictx pointer is invalid (NULL) MAPISTORE_ERR_INVALID_PARAMETER in case other parameters are not valid MAPISTORE_ERR_DATABASE_OPS in case of MySQL error */static enum mapistore_error mysql_record_get_fmid(struct indexing_context *ictx, const char *username, const char *uri, bool partial, uint64_t *fmidp, bool *soft_deletedp){ enum MYSQLRESULT ret; char *sql, *uri_like; MYSQL_RES *res; MYSQL_ROW row; TALLOC_CTX *mem_ctx; // Sanity checks MAPISTORE_RETVAL_IF(!ictx, MAPISTORE_ERR_NOT_INITIALIZED, NULL); MAPISTORE_RETVAL_IF(!username, MAPISTORE_ERR_INVALID_PARAMETER, NULL); MAPISTORE_RETVAL_IF(!uri, MAPISTORE_ERR_INVALID_PARAMETER, NULL); MAPISTORE_RETVAL_IF(!fmidp, MAPISTORE_ERR_INVALID_PARAMETER, NULL); MAPISTORE_RETVAL_IF(!soft_deletedp, MAPISTORE_ERR_INVALID_PARAMETER, NULL); mem_ctx = talloc_named(NULL, 0, "mysql_record_get_fmid"); sql = talloc_asprintf(mem_ctx, "SELECT fmid, soft_deleted FROM "INDEXING_TABLE" " "WHERE username = '%s'", _sql(mem_ctx, username)); if (partial) { uri_like = talloc_strdup(mem_ctx, uri); string_replace(uri_like, '*', '%'); sql = talloc_asprintf_append(sql, " AND url LIKE '%s'", _sql(mem_ctx, uri_like)); } else { sql = talloc_asprintf_append(sql, " AND url = '%s'", _sql(mem_ctx, uri)); } ret = select_without_fetch(MYSQL(ictx), sql, &res); MAPISTORE_RETVAL_IF(ret == MYSQL_NOT_FOUND, MAPISTORE_ERR_NOT_FOUND, mem_ctx); MAPISTORE_RETVAL_IF(ret != MYSQL_SUCCESS, MAPISTORE_ERR_DATABASE_OPS, mem_ctx); row = mysql_fetch_row(res); *fmidp = strtoull(row[0], NULL, 0); *soft_deletedp = strtoull(row[1], NULL, 0) == 1; mysql_free_result(res); talloc_free(mem_ctx); return MAPISTORE_SUCCESS;}
开发者ID:bencer,项目名称:openchange,代码行数:65,
示例7: talloc_asprintf_appendstatic char *start_main(char *ret, const char *why){ return talloc_asprintf_append(ret, "/* The example %s, so fake function wrapper inserted *//n" "int main(int argc, char *argv[])/n" "{/n", why);}
开发者ID:atbrox,项目名称:ccan,代码行数:7,
示例8: talloc_asprintf/** /details Build the binding string and flags given profile and global options. /param mapi_ctx pointer to the MAPI context /param mem_ctx pointer to the memory allocation context /param server string representing the server FQDN or IP address /param profile pointer to the MAPI profile structure /return valid allocated string on success, otherwise NULL */static char *build_binding_string(struct mapi_context *mapi_ctx, TALLOC_CTX *mem_ctx, const char *server, struct mapi_profile *profile){ char *binding; /* Sanity Checks */ if (!profile) return NULL; if (!server) return NULL; if (!mapi_ctx) return NULL; binding = talloc_asprintf(mem_ctx, "ncacn_ip_tcp:%s[", server); /* If dump-data option is enabled */ if (mapi_ctx->dumpdata == true) { binding = talloc_strdup_append(binding, "print,"); } /* If seal option is enabled in the profile */ if (profile->seal == true) { binding = talloc_strdup_append(binding, "seal,"); } /* If localaddress parameter is available in the profile */ if (profile->localaddr) { binding = talloc_asprintf_append(binding, "localaddress=%s,", profile->localaddr); } binding = talloc_strdup_append(binding, "]"); return binding;}
开发者ID:proxymoron,项目名称:openchange,代码行数:42,
示例9: sddl_flags_to_string/* encode an ACL in SDDL format*/static char *sddl_encode_acl(TALLOC_CTX *mem_ctx, const struct security_acl *acl, uint32_t flags, const struct dom_sid *domain_sid){ char *sddl; int i; /* add any ACL flags */ sddl = sddl_flags_to_string(mem_ctx, acl_flags, flags, False); if (sddl == NULL) goto failed; /* now the ACEs, encoded in braces */ for (i=0;i<acl->num_aces;i++) { char *ace = sddl_encode_ace(sddl, &acl->aces[i], domain_sid); if (ace == NULL) goto failed; sddl = talloc_asprintf_append(sddl, "(%s)", ace); if (sddl == NULL) goto failed; talloc_free(ace); } return sddl;failed: talloc_free(sddl); return NULL;}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:28,
示例10: _get_tags_as_stringstatic const char *_get_tags_as_string (const void *ctx, notmuch_message_t *message){ notmuch_tags_t *tags; int first = 1; const char *tag; char *result; result = talloc_strdup (ctx, ""); if (result == NULL) return NULL; for (tags = notmuch_message_get_tags (message); notmuch_tags_valid (tags); notmuch_tags_move_to_next (tags)) { tag = notmuch_tags_get (tags); result = talloc_asprintf_append (result, "%s%s", first ? "" : " ", tag); first = 0; } return result;}
开发者ID:briansniffen,项目名称:notmuch,代码行数:25,
示例11: talloc_arraystatic char *example_obj_list(struct manifest *m, struct ccan_file *f){ struct manifest **deps = talloc_array(f, struct manifest *, 0); char **lines, *list; unsigned int i; /* This one for a start. */ add_dep(&deps, m->basename); /* Other modules implied by includes. */ for (lines = get_ccan_file_lines(f); *lines; lines++) { unsigned preflen = strspn(*lines, " /t"); if (strstarts(*lines + preflen, "#include <ccan/")) { char *modname; modname = talloc_strdup(f, *lines + preflen + strlen("#include <ccan/")); modname[strcspn(modname, "/")] = '/0'; if (!have_mod(deps, modname)) add_dep(&deps, modname); } } list = talloc_strdup(f, ""); for (i = 0; i < talloc_get_size(deps) / sizeof(*deps); i++) { if (deps[i]->compiled[COMPILE_NORMAL]) list = talloc_asprintf_append(list, " %s", deps[i]->compiled [COMPILE_NORMAL]); } return list;}
开发者ID:atbrox,项目名称:ccan,代码行数:32,
示例12: listdent_add_dent/* add this to the list, called by the callback */void listdent_add_dent(TSK_FS_DENT *fs_dent, TSK_FS_DATA *fs_data, struct dentwalk *dentlist) { struct dentwalk *p = talloc(dentlist, struct dentwalk); p->path = talloc_strndup(p, fs_dent->name, fs_dent->name_max - 1); p->type = p->id = 0; if(fs_data) { p->type = fs_data->type; p->id = fs_data->id; } /* print the data stream name if it exists and is not the default NTFS */ if ((fs_data) && (((fs_data->type == NTFS_ATYPE_DATA) && (strcmp(fs_data->name, "$Data") != 0)) || ((fs_data->type == NTFS_ATYPE_IDXROOT) && (strcmp(fs_data->name, "$I30") != 0)))) { p->path = talloc_asprintf_append(p->path, ":%s", fs_data->name); } p->alloc = 1; // allocated if(fs_dent->flags & TSK_FS_DENT_FLAG_UNALLOC) { if((fs_dent->fsi) && (fs_dent->fsi->flags & TSK_FS_INODE_FLAG_ALLOC)) p->alloc = 2; // realloc else p->alloc = 0; // unalloc } p->inode = fs_dent->inode; p->ent_type = fs_dent->ent_type; list_add_tail(&p->list, &dentlist->list);}
开发者ID:backupManager,项目名称:pyflag,代码行数:33,
示例13: run_command/* Tallocs *output off ctx; return false if command fails. */bool run_command(const void *ctx, unsigned int *time_ms, char **output, const char *fmt, ...){ va_list ap; char *cmd; bool ok; unsigned int default_time = default_timeout_ms; if (!time_ms) time_ms = &default_time; else if (*time_ms == 0) { *output = talloc_strdup(ctx, "/n== TIMED OUT ==/n"); return false; } va_start(ap, fmt); cmd = talloc_vasprintf(ctx, fmt, ap); va_end(ap); *output = run_with_timeout(ctx, cmd, &ok, time_ms); if (ok) return true; if (!*output) err(1, "Problem running child"); if (*time_ms == 0) *output = talloc_asprintf_append(*output, "/n== TIMED OUT ==/n"); return false;}
开发者ID:stewartsmith,项目名称:ccan,代码行数:30,
示例14: talloc_strdupstatic char *join_lines(void *ta_ctx, char **parts, int num_parts){ char *res = talloc_strdup(ta_ctx, ""); for (int n = 0; n < num_parts; n++) res = talloc_asprintf_append(res, "%s%s", n ? "/n" : "", parts[n]); return res;}
开发者ID:Velvetine,项目名称:mpv,代码行数:7,
示例15: talloc_strdup/* turn a set of flags into a string*/static char *sddl_flags_to_string(TALLOC_CTX *mem_ctx, const struct flag_map *map, uint32_t flags, BOOL check_all){ int i; char *s; /* try to find an exact match */ for (i=0;map[i].name;i++) { if (map[i].flag == flags) { return talloc_strdup(mem_ctx, map[i].name); } } s = talloc_strdup(mem_ctx, ""); /* now by bits */ for (i=0;map[i].name;i++) { if ((flags & map[i].flag) != 0) { s = talloc_asprintf_append(s, "%s", map[i].name); if (s == NULL) goto failed; flags &= ~map[i].flag; } } if (check_all && flags != 0) { goto failed; } return s;failed: talloc_free(s); return NULL;}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:37,
示例16: talloc_asprintfstatic char *connection_string_from_parameters(TALLOC_CTX *mem_ctx, struct namedprops_mysql_params *parms){ char *connection_string; connection_string = talloc_asprintf(mem_ctx, "mysql://%s", parms->user); if (!connection_string) return NULL; if (parms->pass && parms->pass[0]) { connection_string = talloc_asprintf_append(connection_string, ":%s", parms->pass); if (!connection_string) return NULL; } connection_string = talloc_asprintf_append(connection_string, "@%s", parms->host); if (!connection_string) return NULL; if (parms->port) { connection_string = talloc_asprintf_append(connection_string, ":%d", parms->port); if (!connection_string) return NULL; } return talloc_asprintf_append(connection_string, "/%s", parms->db);}
开发者ID:antmd,项目名称:openchange,代码行数:18,
示例17: dsdb_subSchema_objectClassesWERROR dsdb_subSchema_objectClasses(const struct dsdb_schema *schema, TALLOC_CTX *mem_ctx){ struct ldb_message_element *e; struct dsdb_class *c; e = talloc_zero(mem_ctx, struct ldb_message_element); W_ERROR_HAVE_NO_MEMORY(e); for (c = schema->classes; c; c = c->next) { const char *class_type; char *v; switch (c->objectClassCategory) { case 0: /* * NOTE: this is an type 88 class * e.g. 2.5.6.6 NAME 'person' * but w2k3 gives STRUCTURAL here! */ class_type = "STRUCTURAL"; break; case 1: class_type = "STRUCTURAL"; break; case 2: class_type = "ABSTRACT"; break; case 3: class_type = "AUXILIARY"; break; default: class_type = "UNKNOWN"; break; } v = talloc_asprintf(e, "( %s NAME '%s' SUB %s %s ", c->governsID_oid, c->lDAPDisplayName, c->subClassOf, class_type); W_ERROR_HAVE_NO_MEMORY(v); v = dsdb_subSchema_list_append(v, "MUST"); W_ERROR_HAVE_NO_MEMORY(v); v = dsdb_subSchema_list_append(v, "MAY"); W_ERROR_HAVE_NO_MEMORY(v); v = talloc_asprintf_append(v, ")"); W_ERROR_HAVE_NO_MEMORY(v); DEBUG(0,("%s/n", v)); } return WERR_FOOBAR;}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:55,
示例18: switch/* turn a node status flags field into a string*/static char *node_status_flags(TALLOC_CTX *mem_ctx, uint16_t flags){ char *ret; const char *group = " "; const char *type = "B"; if (flags & NBT_NM_GROUP) { group = "<GROUP>"; } switch (flags & NBT_NM_OWNER_TYPE) { case NBT_NODE_B: type = "B"; break; case NBT_NODE_P: type = "P"; break; case NBT_NODE_M: type = "M"; break; case NBT_NODE_H: type = "H"; break; } ret = talloc_asprintf(mem_ctx, "%s %s", group, type); if (flags & NBT_NM_DEREGISTER) { ret = talloc_asprintf_append(ret, " <DEREGISTERING>"); } if (flags & NBT_NM_CONFLICT) { ret = talloc_asprintf_append(ret, " <CONFLICT>"); } if (flags & NBT_NM_ACTIVE) { ret = talloc_asprintf_append(ret, " <ACTIVE>"); } if (flags & NBT_NM_PERMANENT) { ret = talloc_asprintf_append(ret, " <PERMANENT>"); } return ret;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:45,
示例19: talloc_strdupstatic char *obj_list(const struct manifest *m){ char *list = talloc_strdup(m, ""); struct ccan_file *i; /* Objects from all the C files. */ list_for_each(&m->c_files, i, list) list = talloc_asprintf_append(list, "%s ", i->compiled); return list;}
开发者ID:stewartsmith,项目名称:ccan,代码行数:11,
示例20: talloc_strdup/* form a binding string from a binding structure*/const char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b){ char *s = talloc_strdup(mem_ctx, ""); int i; const char *t_name=NULL; for (i=0;i<ARRAY_SIZE(transports);i++) { if (transports[i].transport == b->transport) { t_name = transports[i].name; } } if (!t_name) { return NULL; } if (!GUID_all_zero(&b->object.uuid)) { s = talloc_asprintf(s, "%[email C++ talloc_autofree_context函数代码示例 C++ talloc_asprintf函数代码示例
|