Changeset 2b4122c
- Timestamp:
- Jun 20, 2013, 6:29:18 AM (11 years ago)
- 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. - Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
AUTHORS
r1d2c4c3 r80c0fc7 3 3 4 4 The following people have provided patches or other contributions: 5 Alex Vandiver 6 Kevin Chen 7 Arun Tharuvai 5 8 Sam Hartman 6 Alex Vandiver7 Geoffrey Thomas8 9 Derrick Brashear 9 10 David Glasser 11 Eric Price 10 12 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 14 34 15 BarnOwl is based on code from Owl, which was originally primar ly35 BarnOwl is based on code from Owl, which was originally primarily 16 36 written by James Kretchmar. Erik Nygren also made substantial 17 contributions and improvem nts to the program.37 contributions and improvements to the program. 18 38 19 The following people provided patches and other tech incal support for39 The following people provided patches and other technical support for 20 40 Owl: 21 41 … … 30 50 Mark Eichin 31 51 32 Mark Eichin is also maintaining the debian package of Owl.52 Mark Eichin is also maintaining the Debian package of Owl. 33 53 34 54 The following people helped with beta testing the earliest versions of -
t/variable.t
r4953c44 r5d8c9a7 17 17 BarnOwl::unset("-q", "intvar"); 18 18 is(BarnOwl::getvar("intvar"), "24", "intvar unset bogus"); 19 BarnOwl::new_variable_int("intvar", { default => 7 }); 20 isnt(BarnOwl::getvar("intvar"), "7", "intvar reinit shouldn't override preexisting value"); 19 21 20 22 BarnOwl::new_variable_bool("boolvar", { default => 1 }); … … 28 30 BarnOwl::unset("-q", "boolvar"); 29 31 is(BarnOwl::getvar("boolvar"), "off", "boolvar unset"); 32 BarnOwl::new_variable_bool("boolvar", { default => 1 }); 33 isnt(BarnOwl::getvar("boolvar"), "on", "boolvar reinit shouldn't override preexisting value"); 30 34 31 35 BarnOwl::new_variable_string("strvar", { default => "monkey" }); … … 37 41 BarnOwl::unset("-q", "strvar"); 38 42 is(BarnOwl::getvar("strvar"), "cuttlefish", "strvar unset bogus"); 43 BarnOwl::new_variable_string("strvar", { default => "monkey" }); 44 isnt(BarnOwl::getvar("strvar"), "monkey", "strvar reinit shouldn't override value"); 39 45 40 46 BarnOwl::new_variable_enum("enumvar", { validsettings => [qw/foo bar baz/], default => "bar" }); … … 46 52 BarnOwl::unset("-q", "enumvar"); 47 53 is(BarnOwl::getvar("enumvar"), "baz", "enumvar unset bogus"); 54 BarnOwl::new_variable_enum("enumvar", { validsettings => [qw/foo bar baz/], default => "bar" }); 55 isnt(BarnOwl::getvar("enumvar"), "bar", "enumvar reinit shouldn't override value"); 48 56 49 57 BarnOwl::new_variable_int("intvar2"); … … 60 68 BarnOwl::new_variable_full("fullvar", { 61 69 validsettings => '<short-words>', 62 get_tostring => sub { "value is " .$value },70 get_tostring => sub { $value }, 63 71 set_fromstring => sub { 64 65 $value = $_[0];72 die "Too long" unless $_[0] =~ /^...?$/; 73 $value = lc($_[0]); 66 74 }, 67 75 takes_on_off => 1 68 76 }); 69 is(BarnOwl::getvar("fullvar"), " value isfoo", "fullvar get");70 BarnOwl::set("-q", "fullvar", " bar");71 is(BarnOwl::getvar("fullvar"), " value isbar", "fullvar set");77 is(BarnOwl::getvar("fullvar"), "foo", "fullvar get"); 78 BarnOwl::set("-q", "fullvar", "Bar"); 79 is(BarnOwl::getvar("fullvar"), "bar", "fullvar set"); 72 80 BarnOwl::set("-q", "fullvar"); 73 is(BarnOwl::getvar("fullvar"), " value ison", "fullvar set2");81 is(BarnOwl::getvar("fullvar"), "on", "fullvar set2"); 74 82 BarnOwl::unset("-q", "fullvar"); 75 is(BarnOwl::getvar("fullvar"), " value isoff", "fullvar unset");83 is(BarnOwl::getvar("fullvar"), "off", "fullvar unset"); 76 84 BarnOwl::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"); 85 is(BarnOwl::getvar("fullvar"), "off", "fullvar set bogus"); 86 $value = "xyz"; 87 is(BarnOwl::getvar("fullvar"), "xyz", "fullvar set out-of-band"); 88 # Kinda verbose, but better to test all forms 89 my $newvalue = "foo"; 90 BarnOwl::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 }); 99 is(BarnOwl::getvar("fullvar"), "xyz", "fullvar reinit doesn't override value"); 100 $newvalue = "abc"; 101 is(BarnOwl::getvar("fullvar"), "abc", "fullvar reinit changed setters"); 80 102 81 103 1; -
variable.c
r6a8b519 r9d4dfdc 612 612 void owl_variable_dict_add_variable(owl_vardict * vardict, 613 613 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 } 614 620 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 } 615 626 } 616 627 … … 777 788 g_free(v->default_str); 778 789 g_free(v->validsettings); 779 g_value_unset(&(v->val)); 790 if (v->type != OWL_VARIABLE_OTHER) 791 g_value_unset(&(v->val)); 780 792 g_closure_unref(v->get_tostring_fn); 781 793 g_closure_unref(v->set_fromstring_fn);
Note: See TracChangeset
for help on using the changeset viewer.