[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.6 and 1.7

version 1.6, 2012/01/21 08:40:09 version 1.7, 2012/01/21 11:12:13
Line 28 
Line 28 
  * a splay tree.   * a splay tree.
  */   */
   
 SPLAY_GENERATE(options_tree, options_entry, entry, options_cmp);  RB_GENERATE(options_tree, options_entry, entry, options_cmp);
   
 int  int
 options_cmp(struct options_entry *o1, struct options_entry *o2)  options_cmp(struct options_entry *o1, struct options_entry *o2)
Line 39 
Line 39 
 void  void
 options_init(struct options *oo, struct options *parent)  options_init(struct options *oo, struct options *parent)
 {  {
         SPLAY_INIT(&oo->tree);          RB_INIT(&oo->tree);
         oo->parent = parent;          oo->parent = parent;
 }  }
   
Line 48 
Line 48 
 {  {
         struct options_entry    *o;          struct options_entry    *o;
   
         while (!SPLAY_EMPTY(&oo->tree)) {          while (!RB_EMPTY(&oo->tree)) {
                 o = SPLAY_ROOT(&oo->tree);                  o = RB_ROOT(&oo->tree);
                 SPLAY_REMOVE(options_tree, &oo->tree, o);                  RB_REMOVE(options_tree, &oo->tree, o);
                 xfree(o->name);                  xfree(o->name);
                 if (o->type == OPTIONS_STRING)                  if (o->type == OPTIONS_STRING)
                         xfree(o->str);                          xfree(o->str);
Line 64 
Line 64 
         struct options_entry    p;          struct options_entry    p;
   
         p.name = (char *) name;          p.name = (char *) name;
         return (SPLAY_FIND(options_tree, &oo->tree, &p));          return (RB_FIND(options_tree, &oo->tree, &p));
 }  }
   
 struct options_entry *  struct options_entry *
Line 73 
Line 73 
         struct options_entry    *o, p;          struct options_entry    *o, p;
   
         p.name = (char *) name;          p.name = (char *) name;
         o = SPLAY_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;
                 if (oo == NULL)                  if (oo == NULL)
                         break;                          break;
                 o = SPLAY_FIND(options_tree, &oo->tree, &p);                  o = RB_FIND(options_tree, &oo->tree, &p);
         }          }
         return (o);          return (o);
 }  }
Line 91 
Line 91 
         if ((o = options_find1(oo, name)) == NULL)          if ((o = options_find1(oo, name)) == NULL)
                 return;                  return;
   
         SPLAY_REMOVE(options_tree, &oo->tree, o);          RB_REMOVE(options_tree, &oo->tree, o);
         xfree(o->name);          xfree(o->name);
         if (o->type == OPTIONS_STRING)          if (o->type == OPTIONS_STRING)
                 xfree(o->str);                  xfree(o->str);
Line 107 
Line 107 
         if ((o = options_find1(oo, name)) == NULL) {          if ((o = options_find1(oo, name)) == NULL) {
                 o = xmalloc(sizeof *o);                  o = xmalloc(sizeof *o);
                 o->name = xstrdup(name);                  o->name = xstrdup(name);
                 SPLAY_INSERT(options_tree, &oo->tree, o);                  RB_INSERT(options_tree, &oo->tree, o);
         } else if (o->type == OPTIONS_STRING)          } else if (o->type == OPTIONS_STRING)
                 xfree(o->str);                  xfree(o->str);
   
Line 138 
Line 138 
         if ((o = options_find1(oo, name)) == NULL) {          if ((o = options_find1(oo, name)) == NULL) {
                 o = xmalloc(sizeof *o);                  o = xmalloc(sizeof *o);
                 o->name = xstrdup(name);                  o->name = xstrdup(name);
                 SPLAY_INSERT(options_tree, &oo->tree, o);                  RB_INSERT(options_tree, &oo->tree, o);
         } else if (o->type == OPTIONS_STRING)          } else if (o->type == OPTIONS_STRING)
                 xfree(o->str);                  xfree(o->str);
   

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7