[BACK]Return to options.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/options.c between version 1.16 and 1.17

version 1.16, 2015/12/08 08:14:04 version 1.17, 2015/12/11 15:46:57
Line 34 
Line 34 
         struct options  *parent;          struct options  *parent;
 };  };
   
 int     options_cmp(struct options_entry *, struct options_entry *);  static int      options_cmp(struct options_entry *, struct options_entry *);
 RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp);  RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp);
 RB_GENERATE(options_tree, options_entry, entry, options_cmp);  RB_GENERATE(options_tree, options_entry, entry, options_cmp);
   
 int  static void     options_free1(struct options *, struct options_entry *);
   
   static int
 options_cmp(struct options_entry *o1, struct options_entry *o2)  options_cmp(struct options_entry *o1, struct options_entry *o2)
 {  {
         return (strcmp(o1->name, o2->name));          return (strcmp(o1->name, o2->name));
Line 55 
Line 57 
         return (oo);          return (oo);
 }  }
   
   static void
   options_free1(struct options *oo, struct options_entry *o)
   {
           RB_REMOVE(options_tree, &oo->tree, o);
           free((char *)o->name);
           if (o->type == OPTIONS_STRING)
                   free(o->str);
           free(o);
   }
   
 void  void
 options_free(struct options *oo)  options_free(struct options *oo)
 {  {
         struct options_entry    *o;          struct options_entry    *o, *o1;
   
         while (!RB_EMPTY(&oo->tree)) {          RB_FOREACH_SAFE (o, options_tree, &oo->tree, o1)
                 o = RB_ROOT(&oo->tree);                  options_free1(oo, o);
                 RB_REMOVE(options_tree, &oo->tree, o);  
                 free(o->name);  
                 if (o->type == OPTIONS_STRING)  
                         free(o->str);  
                 free(o);  
         }  
         free(oo);          free(oo);
 }  }
   
Line 88 
Line 94 
 {  {
         struct options_entry    p;          struct options_entry    p;
   
         p.name = (char *) name;          p.name = (char *)name;
         return (RB_FIND(options_tree, &oo->tree, &p));          return (RB_FIND(options_tree, &oo->tree, &p));
 }  }
   
Line 97 
Line 103 
 {  {
         struct options_entry    *o, p;          struct options_entry    *o, p;
   
         p.name = (char *) name;          p.name = (char *)name;
         o = RB_FIND(options_tree, &oo->tree, &p);          o = RB_FIND(options_tree, &oo->tree, &p);
         while (o == NULL) {          while (o == NULL) {
                 oo = oo->parent;                  oo = oo->parent;
Line 113 
Line 119 
 {  {
         struct options_entry    *o;          struct options_entry    *o;
   
         if ((o = options_find1(oo, name)) == NULL)          if ((o = options_find1(oo, name)) != NULL)
                 return;                  options_free1(oo, o);
   
         RB_REMOVE(options_tree, &oo->tree, o);  
         free(o->name);  
         if (o->type == OPTIONS_STRING)  
                 free(o->str);  
         free(o);  
 }  }
   
 struct options_entry *  struct options_entry *

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17