@@ -57,7 +57,6 @@ static int validate_config_file_security(const char *config_path); |
| 57 | static int create_config_directory_secure(const char *config_dir); | 57 | static int create_config_directory_secure(const char *config_dir); |
| 58 | static int load_accounts_from_toml(gitswitch_ctx_t *ctx, const toml_document_t *doc); | 58 | static int load_accounts_from_toml(gitswitch_ctx_t *ctx, const toml_document_t *doc); |
| 59 | static int save_accounts_to_toml(const gitswitch_ctx_t *ctx, toml_document_t *doc); | 59 | static int save_accounts_to_toml(const gitswitch_ctx_t *ctx, toml_document_t *doc); |
| 60 | -static int remove_existing_account_sections(toml_document_t *doc); | | |
| 61 | static int parse_account_id_from_section(const char *section_name, uint32_t *account_id); | 60 | static int parse_account_id_from_section(const char *section_name, uint32_t *account_id); |
| 62 | static int validate_account_security(const account_t *account); | 61 | static int validate_account_security(const account_t *account); |
| 63 | | 62 | |
@@ -773,34 +772,6 @@ static int validate_account_security(const account_t *account) { |
| 773 | return 0; | 772 | return 0; |
| 774 | } | 773 | } |
| 775 | | 774 | |
| 776 | -/* Remove all existing account sections from TOML document */ | | |
| 777 | -static int remove_existing_account_sections(toml_document_t *doc) { | | |
| 778 | - size_t i = 0; | | |
| 779 | - | | |
| 780 | - if (!doc) { | | |
| 781 | - set_error(ERR_INVALID_ARGS, "Invalid arguments to remove_existing_account_sections"); | | |
| 782 | - return -1; | | |
| 783 | - } | | |
| 784 | - | | |
| 785 | - /* Iterate through sections and remove account sections */ | | |
| 786 | - while (i < doc->section_count) { | | |
| 787 | - if (string_starts_with(doc->sections[i].name, "accounts.")) { | | |
| 788 | - log_debug("Removing existing account section: %s", doc->sections[i].name); | | |
| 789 | - | | |
| 790 | - /* Shift remaining sections down */ | | |
| 791 | - for (size_t j = i; j < doc->section_count - 1; j++) { | | |
| 792 | - doc->sections[j] = doc->sections[j + 1]; | | |
| 793 | - } | | |
| 794 | - doc->section_count--; | | |
| 795 | - /* Don't increment i since we shifted sections down */ | | |
| 796 | - } else { | | |
| 797 | - i++; | | |
| 798 | - } | | |
| 799 | - } | | |
| 800 | - | | |
| 801 | - return 0; | | |
| 802 | -} | | |
| 803 | - | | |
| 804 | /* Save accounts to TOML document */ | 775 | /* Save accounts to TOML document */ |
| 805 | static int save_accounts_to_toml(const gitswitch_ctx_t *ctx, toml_document_t *doc) { | 776 | static int save_accounts_to_toml(const gitswitch_ctx_t *ctx, toml_document_t *doc) { |
| 806 | char section_name[64]; | 777 | char section_name[64]; |