Changeset 2b4122c


Ignore:
Timestamp:
Jun 20, 2013, 6:29:18 AM (11 years ago)
Author:
Alex Dehnert <adehnert@mit.edu>
Parents:
80d7b44 (diff), 4cb12f80 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 4cb12f80063cf26e1289c4a4b88e120449f27d54 into 80d7b445c48a5c63361e0ae972d0b0264d54ed65
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • AUTHORS

    r1d2c4c3 r80c0fc7  
    33
    44The following people have provided patches or other contributions:
     5  Alex Vandiver
     6  Kevin Chen
     7  Arun Tharuvai
    58  Sam Hartman
    6   Alex Vandiver
    7   Geoffrey Thomas
    89  Derrick Brashear
    910  David Glasser
     11  Eric Price
    1012  Matthew Goldstein
    11   Arun Tharuvai
    12   Kevin Chen
    13   Eric Price
     13  Geoffrey Thomas
     14  Anders Kaseorg
     15  Greg Price
     16  Chris Lesniewski-Laas
     17  Alex Dehnert
     18  Edward Z. Yang
     19  Karl Ramm
     20  Evan Broder
     21  David Benjamin
     22  Cathy Zhang
     23  Joshua Oreman
     24  Leonid Grinberg
     25  Kevin Riggle
     26  Brian Sniffen
     27  William Throwe
     28  Jason Gross
     29  Adam Glasgall
     30  Tim Hill
     31  DD Liu
     32  Betsy Riley
     33  Robert Jacobs
    1434
    15 BarnOwl is based on code from Owl, which was originally primarly
     35BarnOwl is based on code from Owl, which was originally primarily
    1636written by James Kretchmar.  Erik Nygren also made substantial
    17 contributions and improvemnts to the program.
     37contributions and improvements to the program.
    1838
    19 The following people provided patches and other techincal support for
     39The following people provided patches and other technical support for
    2040Owl:
    2141
     
    3050  Mark Eichin
    3151
    32 Mark Eichin is also maintaining the debian package of Owl.
     52Mark Eichin is also maintaining the Debian package of Owl.
    3353
    3454The following people helped with beta testing the earliest versions of
  • t/variable.t

    r4953c44 r5d8c9a7  
    1717BarnOwl::unset("-q", "intvar");
    1818is(BarnOwl::getvar("intvar"), "24", "intvar unset bogus");
     19BarnOwl::new_variable_int("intvar", { default => 7 });
     20isnt(BarnOwl::getvar("intvar"), "7", "intvar reinit shouldn't override preexisting value");
    1921
    2022BarnOwl::new_variable_bool("boolvar", { default => 1 });
     
    2830BarnOwl::unset("-q", "boolvar");
    2931is(BarnOwl::getvar("boolvar"), "off", "boolvar unset");
     32BarnOwl::new_variable_bool("boolvar", { default => 1 });
     33isnt(BarnOwl::getvar("boolvar"), "on", "boolvar reinit shouldn't override preexisting value");
    3034
    3135BarnOwl::new_variable_string("strvar", { default => "monkey" });
     
    3741BarnOwl::unset("-q", "strvar");
    3842is(BarnOwl::getvar("strvar"), "cuttlefish", "strvar unset bogus");
     43BarnOwl::new_variable_string("strvar", { default => "monkey" });
     44isnt(BarnOwl::getvar("strvar"), "monkey", "strvar reinit shouldn't override value");
    3945
    4046BarnOwl::new_variable_enum("enumvar", { validsettings => [qw/foo bar baz/], default => "bar" });
     
    4652BarnOwl::unset("-q", "enumvar");
    4753is(BarnOwl::getvar("enumvar"), "baz", "enumvar unset bogus");
     54BarnOwl::new_variable_enum("enumvar", { validsettings => [qw/foo bar baz/], default => "bar" });
     55isnt(BarnOwl::getvar("enumvar"), "bar", "enumvar reinit shouldn't override value");
    4856
    4957BarnOwl::new_variable_int("intvar2");
     
    6068BarnOwl::new_variable_full("fullvar", {
    6169    validsettings => '<short-words>',
    62     get_tostring => sub { "value is " . $value },
     70    get_tostring => sub { $value },
    6371    set_fromstring => sub {
    64         die "Too long" unless $_[0] =~ /^...?$/;
    65         $value = $_[0];
     72        die "Too long" unless $_[0] =~ /^...?$/;
     73        $value = lc($_[0]);
    6674    },
    6775    takes_on_off => 1
    6876});
    69 is(BarnOwl::getvar("fullvar"), "value is foo", "fullvar get");
    70 BarnOwl::set("-q", "fullvar", "bar");
    71 is(BarnOwl::getvar("fullvar"), "value is bar", "fullvar set");
     77is(BarnOwl::getvar("fullvar"), "foo", "fullvar get");
     78BarnOwl::set("-q", "fullvar", "Bar");
     79is(BarnOwl::getvar("fullvar"), "bar", "fullvar set");
    7280BarnOwl::set("-q", "fullvar");
    73 is(BarnOwl::getvar("fullvar"), "value is on", "fullvar set2");
     81is(BarnOwl::getvar("fullvar"), "on", "fullvar set2");
    7482BarnOwl::unset("-q", "fullvar");
    75 is(BarnOwl::getvar("fullvar"), "value is off", "fullvar unset");
     83is(BarnOwl::getvar("fullvar"), "off", "fullvar unset");
    7684BarnOwl::set("-q", "fullvar", "bogus");
    77 is(BarnOwl::getvar("fullvar"), "value is off", "fullvar set bogus");
    78 $value = "something really long";
    79 is(BarnOwl::getvar("fullvar"), "value is something really long", "fullvar set out-of-band");
     85is(BarnOwl::getvar("fullvar"), "off", "fullvar set bogus");
     86$value = "xyz";
     87is(BarnOwl::getvar("fullvar"), "xyz", "fullvar set out-of-band");
     88# Kinda verbose, but better to test all forms
     89my $newvalue = "foo";
     90BarnOwl::new_variable_full("fullvar", {
     91    validsettings => '<short-words>',
     92    get_tostring => sub { $newvalue },
     93    set_fromstring => sub {
     94        die "Too long" unless $_[0] =~ /^...?$/;
     95        $newvalue = lc($_[0]);
     96    },
     97    takes_on_off => 1
     98});
     99is(BarnOwl::getvar("fullvar"), "xyz", "fullvar reinit doesn't override value");
     100$newvalue = "abc";
     101is(BarnOwl::getvar("fullvar"), "abc", "fullvar reinit changed setters");
    80102
    811031;
  • variable.c

    r6a8b519 r9d4dfdc  
    612612void owl_variable_dict_add_variable(owl_vardict * vardict,
    613613                                    owl_variable * var) {
     614  char *oldvalue = NULL;
     615  owl_variable *oldvar = owl_variable_get_var(vardict, var->name);
     616  /* Save the old value as a string. */
     617  if (oldvar) {
     618    oldvalue = owl_variable_get_tostring(oldvar);
     619  }
    614620  owl_dict_insert_element(vardict, var->name, var, (void (*)(void *))owl_variable_delete);
     621  /* Restore the old value. */
     622  if (oldvalue) {
     623    owl_variable_set_fromstring(var, oldvalue, 0);
     624    g_free(oldvalue);
     625  }
    615626}
    616627
     
    777788  g_free(v->default_str);
    778789  g_free(v->validsettings);
    779   g_value_unset(&(v->val));
     790  if (v->type != OWL_VARIABLE_OTHER)
     791    g_value_unset(&(v->val));
    780792  g_closure_unref(v->get_tostring_fn);
    781793  g_closure_unref(v->set_fromstring_fn);
Note: See TracChangeset for help on using the changeset viewer.