From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BD19F20133 for ; Wed, 1 Mar 2017 02:55:46 +0000 (UTC) From: Eric Wong To: raindrops-public@bogomips.org Subject: [PATCH] TCP_Info: custom documentation for #get! Date: Wed, 1 Mar 2017 02:55:46 +0000 Message-Id: <20170301025546.26233-1-e@80x24.org> List-Id: While #get! is the same as the #initialize method, the former is public and called explicitly by folks wishing to reduce allocation overhead. --- ext/raindrops/linux_tcp_info.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ext/raindrops/linux_tcp_info.c b/ext/raindrops/linux_tcp_info.c index eebca94..4693e47 100644 --- a/ext/raindrops/linux_tcp_info.c +++ b/ext/raindrops/linux_tcp_info.c @@ -131,6 +131,19 @@ void Init_raindrops_linux_tcp_info(void) cTCP_Info = rb_define_class_under(cRaindrops, "TCP_Info", rb_cObject); rb_define_alloc_func(cTCP_Info, alloc); rb_define_private_method(cTCP_Info, "initialize", init, 1); + + /* + * Document-method: Raindrops::TCP_Info#get! + * + * call-seq: + * + * info = Raindrops::TCP_Info.new(tcp_socket) + * info.get!(tcp_socket) + * + * Update an existing TCP_Info objects with the latest stats + * from the given socket. This even allows sharing TCP_Info + * objects between different sockets to avoid garbage. + */ rb_define_method(cTCP_Info, "get!", init, 1); #define TCPI_DEFINE_METHOD(x) \ -- EW