Commits

Dan Boitnott committed e71fbb7

Code cleanup

Comments (0)

Files changed (4)

     return SkStringSet_find(set, str, NULL) != NULL;
 }
 
-SkStringSet* SkStringSet_add(SkStringSet* set, char* str) {
-    if (SkStringSet_contains(set, str))
-        return;
+SkStringSetItem* SkStringSet_add(SkStringSet* set, char* str) {
+    SkStringSetItem* ret = SkStringSet_find(set, str, NULL);
+    if (ret != NULL)
+        return ret;
 
-    SkStringSetItem* newItem = SkStringSetItem_create(str, set->head);
-    set->head = newItem;
+    ret = SkStringSetItem_create(str, set->head);
+    set->head = ret;
+    return ret;
 }
 
 void SkStringSet_remove(SkStringSet* set, char* str) {
 
 SkStringSet* SkStringSet_create();
 int SkStringSet_count(SkStringSet* set);
-SkStringSet* SkStringSet_add(SkStringSet* set, char* str);
+SkStringSetItem* SkStringSet_add(SkStringSet* set, char* str);
 bool SkStringSet_contains(SkStringSet* set, char* str);
+void SkStringSet_remove(SkStringSet* set, char* str);
 
 SkKey* SkKey_create(char* name, char* value, SkKey* next);
 
 SkKeyRing* SkKeyRing_create();
 SkKey* SkKeyRing_find(SkKeyRing* ring, char* name, SkKey** prev);
 SkKey* SkKeyRing_put(SkKeyRing* ring, char* name, char* value);
+void SkKeyRing_remove(SkKeyRing* ring, char* name);
 int SkKeyRing_count(SkKeyRing* ring);
 
 #endif
 
     if (!key) {
         printf("No keys defined.\n");
-        return;
+        return SUCCESS;
     }
 
     printf("Keys           Authorized Users\n");
     SkKey* key; GET_KEY(ring, keyName, key);
     
     if (strlen(userName) > SK_MAX_STRING_SIZE) {
-        fprintf(stderr, "username too long\n", userName);
+        fprintf(stderr, "username too long: %s\n", userName);
         return STRING_TOO_LONG;
     }
 
 
 int cmd_init(int argc, char** argv, SkKeyRing* ring) {
     // Do Nothing. Just let the keyring get created.
+    return SUCCESS;
 }
 
 typedef struct {
         SkCommand cmd = commands[i];
         fprintf(stderr, "  %-7s %s\n", cmd.command, cmd.shortHelp);
     }
+
+    return SUCCESS;
 }
 
 bool loadSystemRing(SkKeyRing* ring) {
 int main(int argc, char** argv) {
     if (argc < 2) {
         cmd_help(argc, argv, NULL);
-        printf("%s", SYSCONFDIR);
         return BAD_ARGUMENT;
     }
 

skiring.xcodeproj/project.pbxproj

 		2F3CB45516FF493D00C35BC1 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0460;
+				LastUpgradeCheck = 0500;
 				ORGANIZATIONNAME = 3enemigos.com;
 			};
 			buildConfigurationList = 2F3CB45816FF493D00C35BC1 /* Build configuration list for PBXProject "skiring" */;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_WARN_CONSTANT_CONVERSION = YES;