Skip to content

Commit 05d6d21

Browse files
amstanmgeier
authored andcommitted
Use the built-in errno module
... instead of hard-coding the error codes in cdef().
1 parent 3020a0b commit 05d6d21

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎jack.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"""
2626
__version__ = "0.2.0"
2727

28+
import errno
2829
from cffi import FFI as _FFI
2930

3031
_ffi = _FFI()
@@ -265,10 +266,6 @@
265266
jack_midi_data_t* jack_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size);
266267
int jack_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size);
267268
uint32_t jack_midi_get_lost_event_count(void* port_buffer);
268-
269-
/* errno.h */
270-
271-
#define EEXIST 17
272269
""")
273270

274271
# Packed structure
@@ -645,7 +642,7 @@ def connect(self, source, destination):
645642
destination = destination.name
646643
err = _lib.jack_connect(self._ptr, source.encode(),
647644
destination.encode())
648-
if err == _lib.EEXIST:
645+
if err == errno.EEXIST:
649646
raise JackError("Connection {0!r} -> {1!r} "
650647
"already exists".format(source, destination))
651648
_check(err,

0 commit comments

Comments
 (0)