tests: add alt to base_init_autoinit3 to check warning on `noautoinit`
[nit.git] / lib / libevent.nit
index f366cb4..58069c8 100644 (file)
@@ -160,6 +160,8 @@ class Connection
                native_buffer_event.write(str.to_cstring, str.length)
        end
 
+       redef fun write_byte(byte) do native_buffer_event.write_byte(byte)
+
        # Write a file to the connection
        #
        # require: `path.file_exists`
@@ -183,6 +185,12 @@ extern class NativeBufferEvent `{ struct bufferevent * `}
                return bufferevent_write(recv, line, length);
        `}
 
+       # Write the byte `value`
+       fun write_byte(value: Int): Int `{
+               unsigned char byt = (unsigned char)value;
+               return bufferevent_write(recv, &byt, 1);
+       `}
+
        # Check if we have anything left in our buffers. If so, we set our connection to be closed
        # on a callback. Otherwise we close it and free it right away.
        fun destroy: Bool `{