Changeset 7372
- Timestamp:
- 02/20/07 00:50:24 (23 months ago)
- Files:
-
- 1 modified
-
trunk/dot/proxy/off.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dot/proxy/off.c
r7369 r7372 62 62 loadOfflineList(); 63 63 } 64 65 addOfflineHost("bradneuberg.name"); 66 printf("Is new site offline: %d\n", isHostAvailableOffline("bradneuberg.name")); 67 fflush(stdout); 68 saveOfflineList(); 64 69 } 65 70 … … 70 75 int addOfflineHost(char host[]){ 71 76 struct offline_list_entry *entry_ptr; 77 struct offline_list_entry *new_entry_ptr; 72 78 73 79 if(isHostAvailableOffline(host) == 1){ … … 77 83 78 84 /* instantiate an entry for this host */ 79 entry_ptr = (struct offline_list_entry *)85 new_entry_ptr = (struct offline_list_entry *) 80 86 malloc(sizeof(struct offline_list_entry)); 81 if( entry_ptr == NULL){87 if(new_entry_ptr == NULL){ 82 88 do_log(L_ERROR, "No memory"); 83 89 return 0; 84 90 } 85 entry_ptr->host_ptr = (char *)malloc((unsigned) (strlen(host) + 1));86 if( entry_ptr->host_ptr == NULL){91 new_entry_ptr->host_ptr = (char *)malloc((unsigned) (strlen(host) + 1)); 92 if(new_entry_ptr->host_ptr == NULL){ 87 93 do_log(L_ERROR, "No memory"); 88 94 return 0; 89 95 } 90 memcpy( entry_ptr->host_ptr, host, strlen(host) + 1);91 entry_ptr->next_ptr = NULL;96 memcpy(new_entry_ptr->host_ptr, host, strlen(host) + 1); 97 new_entry_ptr->next_ptr = NULL; 92 98 93 99 /* add it in the right place */ 94 100 if(offline_list_ptr == NULL){ 95 offline_list_ptr = entry_ptr;101 offline_list_ptr = new_entry_ptr; 96 102 }else{ 97 103 /* shuffle along the list until we get to the end */ … … 100 106 entry_ptr = entry_ptr->next_ptr; 101 107 } 102 entry_ptr->next_ptr = entry_ptr; 103 } 108 entry_ptr->next_ptr = new_entry_ptr; 109 } 110 111 return 1; /* success */ 104 112 } 105 113