1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719
|
From 3328126acc4194b7ac877d815c38dfe3d2192814 Mon Sep 17 00:00:00 2001
From: Lars Kanis <lars.kanis@sincnovation.com>
Date: Thu, 13 Feb 2025 09:24:48 +0100
Subject: [PATCH 06/10] Replace ancient K&R function declarations by ANSI style
---
ext/native/posix_serialport_impl.c | 58 +++++-----------
ext/native/serialport.c | 102 ++++++++++-------------------
ext/native/win_serialport_impl.c | 61 ++++++-----------
3 files changed, 71 insertions(+), 150 deletions(-)
diff --git a/ext/native/posix_serialport_impl.c b/ext/native/posix_serialport_impl.c
index c096e08..8c0283e 100644
--- a/ext/native/posix_serialport_impl.c
+++ b/ext/native/posix_serialport_impl.c
@@ -72,8 +72,7 @@ int get_fd_helper(VALUE io)
#endif
}
-VALUE sp_create_impl(class, _port)
- VALUE class, _port;
+VALUE sp_create_impl(VALUE class, VALUE _port)
{
int fd;
int num_port;
@@ -157,9 +156,7 @@ VALUE sp_create_impl(class, _port)
return sp;
}
-VALUE sp_set_modem_params_impl(argc, argv, self)
- int argc;
- VALUE *argv, self;
+VALUE sp_set_modem_params_impl(int argc, VALUE *argv, VALUE self)
{
int fd;
struct termios params;
@@ -380,9 +377,7 @@ VALUE sp_set_modem_params_impl(argc, argv, self)
return argv[0];
}
-void get_modem_params_impl(self, mp)
- VALUE self;
- struct modem_params *mp;
+void get_modem_params_impl(VALUE self, struct modem_params *mp)
{
int fd;
struct termios params;
@@ -474,8 +469,7 @@ void get_modem_params_impl(self, mp)
}
}
-VALUE sp_set_flow_control_impl(self, val)
- VALUE self, val;
+VALUE sp_set_flow_control_impl(VALUE self, VALUE val)
{
int fd;
int flowc;
@@ -521,8 +515,7 @@ VALUE sp_set_flow_control_impl(self, val)
return val;
}
-VALUE sp_get_flow_control_impl(self)
- VALUE self;
+VALUE sp_get_flow_control_impl(VALUE self)
{
int ret;
int fd;
@@ -551,8 +544,7 @@ VALUE sp_get_flow_control_impl(self)
return INT2FIX(ret);
}
-VALUE sp_set_read_timeout_impl(self, val)
- VALUE self, val;
+VALUE sp_set_read_timeout_impl(VALUE self, VALUE val)
{
int timeout;
int fd;
@@ -591,8 +583,7 @@ VALUE sp_set_read_timeout_impl(self, val)
return val;
}
-VALUE sp_get_read_timeout_impl(self)
- VALUE self;
+VALUE sp_get_read_timeout_impl(VALUE self)
{
int fd;
struct termios params;
@@ -611,22 +602,19 @@ VALUE sp_get_read_timeout_impl(self)
return INT2FIX(params.c_cc[VTIME] * 100);
}
-VALUE sp_set_write_timeout_impl(self, val)
- VALUE self, val;
+VALUE sp_set_write_timeout_impl(VALUE self, VALUE val)
{
rb_notimplement();
return self;
}
-VALUE sp_get_write_timeout_impl(self)
- VALUE self;
+VALUE sp_get_write_timeout_impl(VALUE self)
{
rb_notimplement();
return self;
}
-VALUE sp_break_impl(self, time)
- VALUE self, time;
+VALUE sp_break_impl(VALUE self, VALUE time)
{
int fd;
@@ -642,9 +630,7 @@ VALUE sp_break_impl(self, time)
return Qnil;
}
-void get_line_signals_helper_impl(obj, ls)
- VALUE obj;
- struct line_signals *ls;
+void get_line_signals_helper_impl(VALUE obj, struct line_signals *ls)
{
int fd, status;
@@ -663,9 +649,7 @@ void get_line_signals_helper_impl(obj, ls)
ls->ri = (status & TIOCM_RI ? 1 : 0);
}
-VALUE set_signal_impl(obj, val, sig)
- VALUE obj,val;
- int sig;
+VALUE set_signal_impl(VALUE obj, VALUE val, int sig)
{
int status;
int fd;
@@ -702,20 +686,17 @@ VALUE set_signal_impl(obj, val, sig)
return val;
}
-VALUE sp_set_rts_impl(self, val)
- VALUE self, val;
+VALUE sp_set_rts_impl(VALUE self, VALUE val)
{
return set_signal_impl(self, val, TIOCM_RTS);
}
-VALUE sp_set_dtr_impl(self, val)
- VALUE self, val;
+VALUE sp_set_dtr_impl(VALUE self, VALUE val)
{
return set_signal_impl(self, val, TIOCM_DTR);
}
-VALUE sp_get_rts_impl(self)
- VALUE self;
+VALUE sp_get_rts_impl(VALUE self)
{
struct line_signals ls;
@@ -723,8 +704,7 @@ VALUE sp_get_rts_impl(self)
return INT2FIX(ls.rts);
}
-VALUE sp_get_dtr_impl(self)
- VALUE self;
+VALUE sp_get_dtr_impl(VALUE self)
{
struct line_signals ls;
@@ -733,8 +713,7 @@ VALUE sp_get_dtr_impl(self)
return INT2FIX(ls.dtr);
}
-VALUE sp_flush_input_data_impl(self)
-VALUE self;
+VALUE sp_flush_input_data_impl(VALUE self)
{
int fd;
int ret;
@@ -749,8 +728,7 @@ VALUE self;
return Qtrue;
}
-VALUE sp_flush_output_data_impl(self)
-VALUE self;
+VALUE sp_flush_output_data_impl(VALUE self)
{
int fd;
int ret;
diff --git a/ext/native/serialport.c b/ext/native/serialport.c
index 0c3f276..a5850ff 100644
--- a/ext/native/serialport.c
+++ b/ext/native/serialport.c
@@ -47,8 +47,7 @@ io_open_descriptor_fallback(VALUE klass, int descriptor, int mode, VALUE path, V
* @see SerialPort#new
* @see SerialPort#open
*/
-static VALUE sp_create(class, _port)
- VALUE class, _port;
+static VALUE sp_create(VALUE class, VALUE _port)
{
return sp_create_impl(class, _port);
}
@@ -68,7 +67,7 @@ static VALUE sp_create(class, _port)
* (baud, data_bits = 8, stop_bits = 1, parity = (previous_databits == 8 ? NONE : EVEN))
* A baudrate of nil will keep the old value.
* The default parity depends on the number of databits configured before this function call.
- *
+ *
* @overload set_modem_params(baud, data_bits, stop_bits, parity)
* @param baud [Integer] the baud rate
* @param data_bits [Integer] the number of data bits
@@ -80,9 +79,7 @@ static VALUE sp_create(class, _port)
* @return [Hash] the original paramters
* @raise [ArgumentError] if values are invalide or unsupported
*/
-static VALUE sp_set_modem_params(argc, argv, self)
- int argc;
- VALUE *argv, self;
+static VALUE sp_set_modem_params(int argc, VALUE *argv, VALUE self)
{
return sp_set_modem_params_impl(argc, argv, self);
}
@@ -94,20 +91,18 @@ static VALUE sp_set_modem_params(argc, argv, self)
* @return [nil]
* @note (POSIX) this value is very approximate
*/
-static VALUE sp_break(self, time)
- VALUE self, time;
+static VALUE sp_break(VALUE self, VALUE time)
{
return sp_break_impl(self, time);
}
/*
- * Get the state of the DTR line
+ * Get the state of the DTR line
*
* @note (Windows) DTR is not available
* @return [Integer] the state of DTR line, 0 or 1
*/
-static VALUE sp_get_dtr(self)
- VALUE self;
+static VALUE sp_get_dtr(VALUE self)
{
return sp_get_dtr_impl(self);
}
@@ -118,8 +113,7 @@ static VALUE sp_get_dtr(self)
* @return [Integer] the flow control flag
* @see SerialPort#set_flow_control
*/
-static VALUE sp_get_flow_control(self)
- VALUE self;
+static VALUE sp_get_flow_control(VALUE self)
{
return sp_get_flow_control_impl(self);
}
@@ -130,8 +124,7 @@ static VALUE sp_get_flow_control(self)
* @return [Integer] the read timeout, in milliseconds
* @see SerialPort#set_read_timeout
*/
-static VALUE sp_get_read_timeout(self)
- VALUE self;
+static VALUE sp_get_read_timeout(VALUE self)
{
return sp_get_read_timeout_impl(self);
}
@@ -142,8 +135,7 @@ static VALUE sp_get_read_timeout(self)
* @return [Integer] the state of RTS line, 0 or 1
* @note (Windows) RTS is not available
*/
-static VALUE sp_get_rts(self)
- VALUE self;
+static VALUE sp_get_rts(VALUE self)
{
return sp_get_rts_impl(self);
}
@@ -154,8 +146,7 @@ static VALUE sp_get_rts(self)
* @return [Integer] the write timeout, in milliseconds
* @note (POSIX) write timeouts are not implemented
*/
-static VALUE sp_get_write_timeout(self)
- VALUE self;
+static VALUE sp_get_write_timeout(VALUE self)
{
return sp_get_write_timeout_impl(self);
}
@@ -166,8 +157,7 @@ static VALUE sp_get_write_timeout(self)
* @param val [Integer] the desired state of the DTR line, 0 or 1
* @return [Integer] the original +val+ parameter
*/
-static VALUE sp_set_dtr(self, val)
- VALUE self, val;
+static VALUE sp_set_dtr(VALUE self, VALUE val)
{
return sp_set_dtr_impl(self, val);
}
@@ -182,8 +172,7 @@ static VALUE sp_set_dtr(self, val)
* @note SerialPort::HARD uses RTS/CTS handshaking.
* DSR/DTR is not supported.
*/
-static VALUE sp_set_flow_control(self, val)
- VALUE self, val;
+static VALUE sp_set_flow_control(VALUE self, VALUE val)
{
return sp_set_flow_control_impl(self, val);
}
@@ -200,8 +189,7 @@ static VALUE sp_set_flow_control(self, val)
* @return [Integer] the original +timeout+ parameter
* @note Read timeouts don't mix well with multi-threading
*/
-static VALUE sp_set_read_timeout(self, val)
- VALUE self, val;
+static VALUE sp_set_read_timeout(VALUE self, VALUE val)
{
return sp_set_read_timeout_impl(self, val);
}
@@ -212,8 +200,7 @@ static VALUE sp_set_read_timeout(self, val)
* @param val [Integer] the state of RTS line, 0 or 1
* @return [Integer] the original +val+ parameter
*/
-static VALUE sp_set_rts(self, val)
- VALUE self, val;
+static VALUE sp_set_rts(VALUE self, VALUE val)
{
return sp_set_rts_impl(self, val);
}
@@ -225,8 +212,7 @@ static VALUE sp_set_rts(self, val)
* @return [Integer] the original +val+ parameter
* @note (POSIX) write timeouts are not implemented
*/
-static VALUE sp_set_write_timeout(self, val)
- VALUE self, val;
+static VALUE sp_set_write_timeout(VALUE self, VALUE val)
{
return sp_set_write_timeout_impl(self, val);
}
@@ -234,9 +220,7 @@ static VALUE sp_set_write_timeout(self, val)
/*
* @private helper
*/
-static void get_modem_params(self, mp)
- VALUE self;
- struct modem_params *mp;
+static void get_modem_params(VALUE self, struct modem_params *mp)
{
get_modem_params_impl(self, mp);
}
@@ -248,8 +232,7 @@ static void get_modem_params(self, mp)
* @return [Integer] the original +data_rate+ parameter
* @see SerialPort#set_modem_params
*/
-static VALUE sp_set_data_rate(self, data_rate)
- VALUE self, data_rate;
+static VALUE sp_set_data_rate(VALUE self, VALUE data_rate)
{
VALUE argv[4];
@@ -267,8 +250,7 @@ static VALUE sp_set_data_rate(self, data_rate)
* @return [Integer] the original +data_bits+ parameter
* @see SerialPort#set_modem_params
*/
-static VALUE sp_set_data_bits(self, data_bits)
- VALUE self, data_bits;
+static VALUE sp_set_data_bits(VALUE self, VALUE data_bits)
{
VALUE argv[4];
@@ -286,8 +268,7 @@ static VALUE sp_set_data_bits(self, data_bits)
* @return [Integer] the original +stop_bits+ parameter
* @see SerialPort#set_modem_params
*/
-static VALUE sp_set_stop_bits(self, stop_bits)
- VALUE self, stop_bits;
+static VALUE sp_set_stop_bits(VALUE self, VALUE stop_bits)
{
VALUE argv[4];
@@ -305,8 +286,7 @@ static VALUE sp_set_stop_bits(self, stop_bits)
* @return [Integer] the original +parity+ parameter
* @see SerialPort#set_modem_params
*/
-static VALUE sp_set_parity(self, parity)
- VALUE self, parity;
+static VALUE sp_set_parity(VALUE self, VALUE parity)
{
VALUE argv[4];
@@ -323,8 +303,7 @@ static VALUE sp_set_parity(self, parity)
* @return [Integer] the current baud rate
* @see SerialPort#set_modem_params
*/
-static VALUE sp_get_data_rate(self)
- VALUE self;
+static VALUE sp_get_data_rate(VALUE self)
{
struct modem_params mp;
@@ -339,8 +318,7 @@ static VALUE sp_get_data_rate(self)
* @return [Integer] the current number of data bits
* @see SerialPort#set_modem_params
*/
-static VALUE sp_get_data_bits(self)
- VALUE self;
+static VALUE sp_get_data_bits(VALUE self)
{
struct modem_params mp;
@@ -355,8 +333,7 @@ static VALUE sp_get_data_bits(self)
* @return [Integer] the current number of stop bits
* @see SerialPort#set_modem_params for details
*/
-static VALUE sp_get_stop_bits(self)
- VALUE self;
+static VALUE sp_get_stop_bits(VALUE self)
{
struct modem_params mp;
@@ -371,8 +348,7 @@ static VALUE sp_get_stop_bits(self)
* @return [Integer] the current parity
* @see SerialPort#set_modem_params
*/
-static VALUE sp_get_parity(self)
- VALUE self;
+static VALUE sp_get_parity(VALUE self)
{
struct modem_params mp;
@@ -387,8 +363,7 @@ static VALUE sp_get_parity(self)
* @return [Hash] the serial port configuration
* @see SerialPort#set_modem_params
*/
-static VALUE sp_get_modem_params(self)
- VALUE self;
+static VALUE sp_get_modem_params(VALUE self)
{
struct modem_params mp;
VALUE hash;
@@ -408,9 +383,7 @@ static VALUE sp_get_modem_params(self)
/*
* @api private
*/
-void get_line_signals_helper(obj, ls)
- VALUE obj;
- struct line_signals *ls;
+void get_line_signals_helper(VALUE obj, struct line_signals *ls)
{
get_line_signals_helper_impl(obj, ls);
}
@@ -421,8 +394,7 @@ void get_line_signals_helper(obj, ls)
* @return [Integer] the state of the CTS line, 0 or 1
* @see SerialPort#get_signals
*/
-static VALUE sp_get_cts(self)
- VALUE self;
+static VALUE sp_get_cts(VALUE self)
{
struct line_signals ls;
@@ -437,8 +409,7 @@ static VALUE sp_get_cts(self)
* @return [Integer] the state of the DSR line, 0 or 1
* @see SerialPort#get_signals
*/
-static VALUE sp_get_dsr(self)
- VALUE self;
+static VALUE sp_get_dsr(VALUE self)
{
struct line_signals ls;
@@ -453,8 +424,7 @@ static VALUE sp_get_dsr(self)
* @return [Integer] the state of the DCD line, 0 or 1
* @see SerialPort#get_signals
*/
-static VALUE sp_get_dcd(self)
- VALUE self;
+static VALUE sp_get_dcd(VALUE self)
{
struct line_signals ls;
@@ -469,8 +439,7 @@ static VALUE sp_get_dcd(self)
* @return [Integer] the state of the RI line, 0 or 1
* @see SerialPort#get_signals
*/
-static VALUE sp_get_ri(self)
- VALUE self;
+static VALUE sp_get_ri(VALUE self)
{
struct line_signals ls;
@@ -488,8 +457,7 @@ static VALUE sp_get_ri(self)
* @note (Windows) the rts and dtr values are not included
* @note This method is implemented as both SerialPort#signals and SerialPort#get_signals
*/
-static VALUE sp_signals(self)
- VALUE self;
+static VALUE sp_signals(VALUE self)
{
struct line_signals ls;
VALUE hash;
@@ -515,8 +483,7 @@ static VALUE sp_signals(self)
*
* @return [Boolean] true on success or false if an error occurs.
*/
-static VALUE sp_flush_input_data(self)
- VALUE self;
+static VALUE sp_flush_input_data(VALUE self)
{
return sp_flush_input_data_impl(self);
}
@@ -526,14 +493,13 @@ static VALUE sp_flush_input_data(self)
*
* @return [Boolean] true on success or false if an error occurs.
*/
-static VALUE sp_flush_output_data(self)
- VALUE self;
+static VALUE sp_flush_output_data(VALUE self)
{
return sp_flush_output_data_impl(self);
}
-void Init_serialport()
+void Init_serialport(void)
{
sBaud = rb_str_new2("baud");
sDataBits = rb_str_new2("data_bits");
diff --git a/ext/native/win_serialport_impl.c b/ext/native/win_serialport_impl.c
index 26c5499..0cfb77e 100644
--- a/ext/native/win_serialport_impl.c
+++ b/ext/native/win_serialport_impl.c
@@ -53,8 +53,7 @@ static void _rb_win32_fail(const char *function_call) {
);
}
-VALUE RB_SERIAL_EXPORT sp_create_impl(class, _port)
- VALUE class, _port;
+VALUE RB_SERIAL_EXPORT sp_create_impl(VALUE class, VALUE _port)
{
int fd;
HANDLE fh;
@@ -138,9 +137,7 @@ VALUE RB_SERIAL_EXPORT sp_create_impl(class, _port)
return sp;
}
-VALUE RB_SERIAL_EXPORT sp_set_modem_params_impl(argc, argv, self)
- int argc;
- VALUE *argv, self;
+VALUE RB_SERIAL_EXPORT sp_set_modem_params_impl(int argc, VALUE *argv, VALUE self)
{
HANDLE fh;
DCB dcb;
@@ -275,9 +272,7 @@ VALUE RB_SERIAL_EXPORT sp_set_modem_params_impl(argc, argv, self)
return argv[0];
}
-void RB_SERIAL_EXPORT get_modem_params_impl(self, mp)
- VALUE self;
- struct modem_params *mp;
+void RB_SERIAL_EXPORT get_modem_params_impl(VALUE self, struct modem_params *mp)
{
HANDLE fh;
DCB dcb;
@@ -295,8 +290,7 @@ void RB_SERIAL_EXPORT get_modem_params_impl(self, mp)
mp->parity = dcb.Parity;
}
-VALUE RB_SERIAL_EXPORT sp_set_flow_control_impl(self, val)
- VALUE self, val;
+VALUE RB_SERIAL_EXPORT sp_set_flow_control_impl(VALUE self, VALUE val)
{
HANDLE fh;
int flowc;
@@ -340,8 +334,7 @@ VALUE RB_SERIAL_EXPORT sp_set_flow_control_impl(self, val)
return val;
}
-VALUE RB_SERIAL_EXPORT sp_get_flow_control_impl(self)
- VALUE self;
+VALUE RB_SERIAL_EXPORT sp_get_flow_control_impl(VALUE self)
{
HANDLE fh;
int ret;
@@ -368,8 +361,7 @@ VALUE RB_SERIAL_EXPORT sp_get_flow_control_impl(self)
return INT2FIX(ret);
}
-VALUE RB_SERIAL_EXPORT sp_set_read_timeout_impl(self, val)
- VALUE self, val;
+VALUE RB_SERIAL_EXPORT sp_set_read_timeout_impl(VALUE self, VALUE val)
{
int timeout;
HANDLE fh;
@@ -411,8 +403,7 @@ VALUE RB_SERIAL_EXPORT sp_set_read_timeout_impl(self, val)
return val;
}
-VALUE RB_SERIAL_EXPORT sp_get_read_timeout_impl(self)
- VALUE self;
+VALUE RB_SERIAL_EXPORT sp_get_read_timeout_impl(VALUE self)
{
HANDLE fh;
COMMTIMEOUTS ctout;
@@ -434,8 +425,7 @@ VALUE RB_SERIAL_EXPORT sp_get_read_timeout_impl(self)
return INT2FIX(ctout.ReadTotalTimeoutConstant);
}
-VALUE RB_SERIAL_EXPORT sp_set_write_timeout_impl(self, val)
- VALUE self, val;
+VALUE RB_SERIAL_EXPORT sp_set_write_timeout_impl(VALUE self, VALUE val)
{
int timeout;
HANDLE fh;
@@ -469,8 +459,7 @@ VALUE RB_SERIAL_EXPORT sp_set_write_timeout_impl(self, val)
return val;
}
-VALUE RB_SERIAL_EXPORT sp_get_write_timeout_impl(self)
- VALUE self;
+VALUE RB_SERIAL_EXPORT sp_get_write_timeout_impl(VALUE self)
{
HANDLE fh;
COMMTIMEOUTS ctout;
@@ -484,8 +473,7 @@ VALUE RB_SERIAL_EXPORT sp_get_write_timeout_impl(self)
return INT2FIX(ctout.WriteTotalTimeoutMultiplier);
}
-static void delay_ms(time)
- int time;
+static void delay_ms(int time)
{
HANDLE ev;
@@ -503,8 +491,7 @@ static void delay_ms(time)
CloseHandle(ev);
}
-VALUE RB_SERIAL_EXPORT sp_break_impl(self, time)
- VALUE self, time;
+VALUE RB_SERIAL_EXPORT sp_break_impl(VALUE self, VALUE time)
{
HANDLE fh;
@@ -522,9 +509,7 @@ VALUE RB_SERIAL_EXPORT sp_break_impl(self, time)
return Qnil;
}
-void RB_SERIAL_EXPORT get_line_signals_helper_impl(obj, ls)
- VALUE obj;
- struct line_signals *ls;
+void RB_SERIAL_EXPORT get_line_signals_helper_impl(VALUE obj, struct line_signals *ls)
{
HANDLE fh;
unsigned long status; /* DWORD */
@@ -541,9 +526,7 @@ void RB_SERIAL_EXPORT get_line_signals_helper_impl(obj, ls)
ls->ri = (status & MS_RING_ON ? 1 : 0);
}
-static VALUE set_signal(obj, val, sigoff, sigon)
- VALUE obj,val;
- int sigoff, sigon;
+static VALUE set_signal(VALUE obj, VALUE val, int sigoff, int sigon)
{
HANDLE fh;
int set, sig;
@@ -573,27 +556,23 @@ static VALUE set_signal(obj, val, sigoff, sigon)
return val;
}
-VALUE RB_SERIAL_EXPORT sp_set_rts_impl(self, val)
- VALUE self, val;
+VALUE RB_SERIAL_EXPORT sp_set_rts_impl(VALUE self, VALUE val)
{
return set_signal(self, val, CLRRTS, SETRTS);
}
-VALUE RB_SERIAL_EXPORT sp_set_dtr_impl(self, val)
- VALUE self, val;
+VALUE RB_SERIAL_EXPORT sp_set_dtr_impl(VALUE self, VALUE val)
{
return set_signal(self, val, CLRDTR, SETDTR);
}
-VALUE RB_SERIAL_EXPORT sp_get_rts_impl(self)
- VALUE self;
+VALUE RB_SERIAL_EXPORT sp_get_rts_impl(VALUE self)
{
rb_notimplement();
return self;
}
-VALUE RB_SERIAL_EXPORT sp_get_dtr_impl(self)
- VALUE self;
+VALUE RB_SERIAL_EXPORT sp_get_dtr_impl(VALUE self)
{
rb_notimplement();
return self;
@@ -601,8 +580,7 @@ VALUE RB_SERIAL_EXPORT sp_get_dtr_impl(self)
#define PURGE_RXABORT 0x02
#define PURGE_RXCLEAR 0x08
-VALUE RB_SERIAL_EXPORT sp_flush_input_data_impl(self)
- VALUE self;
+VALUE RB_SERIAL_EXPORT sp_flush_input_data_impl(VALUE self)
{
BOOL ret;
HANDLE fh;
@@ -618,8 +596,7 @@ VALUE RB_SERIAL_EXPORT sp_flush_input_data_impl(self)
#define PURGE_TXABORT 0x01
#define PURGE_TXCLEAR 0x04
-VALUE RB_SERIAL_EXPORT sp_flush_output_data_impl(self)
- VALUE self;
+VALUE RB_SERIAL_EXPORT sp_flush_output_data_impl(VALUE self)
{
BOOL ret;
HANDLE fh;
--
2.39.5
|