Browse Source

Simplify caca_create_display call

caca_create_display is the same as caca_create_display_with_driver
with a NULL driver, so we can simply call caca_create_display_with_driver.
main
Pascal Terjan 3 days ago
parent
commit
f8878d8ba4
1 changed files with 5 additions and 12 deletions
  1. +5
    -12
      ruby/caca-display.c

+ 5
- 12
ruby/caca-display.c View File

@@ -69,22 +69,15 @@ static VALUE display_initialize(int argc, VALUE* argv, VALUE self)
if(cv != Qnil)
canvas = DATA_PTR(cv);

if(driver == NULL)
{
display = caca_create_display(canvas);
if(display && NIL_P(cv))
{
cv = canvas_create(caca_get_canvas(display));
}
}
else
display = caca_create_display_with_driver(canvas, driver);
if(display == NULL)
{
display = caca_create_display_with_driver(canvas, driver);
rb_raise(rb_eRuntimeError, "%s", strerror(errno));
}

if(display == NULL)
if(NIL_P(cv))
{
rb_raise(rb_eRuntimeError, "%s", strerror(errno));
cv = canvas_create(caca_get_canvas(display));
}

_SELF = display;


Loading…
Cancel
Save