MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / activation_create_unique

Function activation_create_unique

src/cli/activation_transaction.c:980–1010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

978}
979
980static cbm_activation_transaction_status_t activation_create_unique(
981 const cbm_activation_transaction_t *transaction, const char *tag, char **path_out,
982 char **name_out, activation_native_file_t *file_out, activation_file_identity_t *identity_out) {
983 *path_out = NULL;
984 *name_out = NULL;
985 *file_out = ACTIVATION_INVALID_FILE;
986 for (unsigned int attempt = 0; attempt < 1024U; attempt++) {
987 char *candidate = activation_unique_path(transaction->directory_path, tag);
988 if (!candidate) {
989 return CBM_ACTIVATION_TRANSACTION_NO_MEMORY;
990 }
991 char *name = activation_path_name_copy(candidate);
992 if (!name) {
993 free(candidate);
994 return CBM_ACTIVATION_TRANSACTION_NO_MEMORY;
995 }
996 activation_create_status_t created =
997 activation_private_file_create(transaction, candidate, name, file_out, identity_out);
998 if (created == ACTIVATION_CREATE_OK) {
999 *path_out = candidate;
1000 *name_out = name;
1001 return CBM_ACTIVATION_TRANSACTION_OK;
1002 }
1003 free(candidate);
1004 free(name);
1005 if (created != ACTIVATION_CREATE_EXISTS) {
1006 return CBM_ACTIVATION_TRANSACTION_IO;
1007 }
1008 }
1009 return CBM_ACTIVATION_TRANSACTION_IO;
1010}
1011
1012#ifdef _WIN32
1013static bool activation_external_snapshot_with_owner(const char *path, bool require_current_owner,

Calls 3

activation_unique_pathFunction · 0.85

Tested by

no test coverage detected