ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/tools.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/tools.c (file contents):
Revision 1.36 by ats, Sun Apr 4 23:48:26 2004 UTC vs.
Revision 1.40 by ats, Mon Apr 5 01:06:02 2004 UTC

# Line 74 | Line 74 | static mapping_t *mapping = NULL;
74   #endif
75  
76   #ifdef SOLARIS
77 < char *get_svr_from_bsd(char *bsd){
77 > const char *get_svr_from_bsd(const char *bsd){
78   #ifdef HAVE_LIBDEVINFO_H
79          mapping_t *map_ptr;
80          for(map_ptr = mapping; map_ptr != NULL; map_ptr = map_ptr->next)
# Line 89 | Line 89 | void add_mapping(char *bsd, char *svr){
89          mapping_t *map_ptr;
90          mapping_t *map_end_ptr;
91  
92        bsd = strdup(bsd);
93        svr = strdup(svr);
94
92          if (mapping == NULL){
93                  mapping = malloc(sizeof(mapping_t));
94                  if (mapping == NULL) return;
# Line 114 | Line 111 | void add_mapping(char *bsd, char *svr){
111          }
112  
113          map_ptr->next = NULL;
114 <        map_ptr->bsd = bsd;
115 <        map_ptr->svr = svr;
114 >        map_ptr->bsd = strdup(bsd);
115 >        map_ptr->svr = strdup(svr);
116  
117          return;
118   }
# Line 216 | Line 213 | int build_mapping(){
213          int found;
214  
215          if ((kc = kstat_open()) == NULL) {
216 <                return;
216 >                return 1;
217          }
218  
219          for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
# Line 410 | Line 407 | size_t strlcat(char *dst, const char *src, size_t siz)
407   }
408  
409   #endif
410 +
411 + char *update_string(char **dest, const char *src) {
412 +        char *new;
413 +
414 +        new = realloc(*dest, strlen(src) + 1);
415 +        if (new == NULL) {
416 +                return NULL;
417 +        }
418 +
419 +        strcpy(new, src);
420 +        *dest = new;
421 +        return new;
422 + }
423  
424   long long get_ll_match(char *line, regmatch_t *match){
425          char *ptr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines