[OPEN-ILS-DEV] PATCH: socket_bundle.[ch] (tidying up)

Mike Rylander mrylander at gmail.com
Mon Jun 11 21:09:34 EDT 2007


On 5/31/07, Scott McKellar <mck9 at swbell.net> wrote:
> These patches are an exercise in tidying up, mostly by turning global
> functions into static functions.

Applied happily.  All the static-izing looked entirely sane to me,
though Bill may say otherwise.  My opinion is, if it ain't used then
lets make it static.  We can export it later if we need to.  (And if
it had/has an underscore, it's definitely meant to be static...)

--miker

>
> 1. I declared several functions as static, and moved their prototypes
> from the header file to the implementation file.  In each case I
> verified that nothing else in the code base calls it, based on a
> snapshot taken on May 17:
>
> - _socket_add_node
> - socket_find_node
> - socket_remove_node
> - _socket_send
> - _socket_route_data
> - _socket_route_data_id
> - _socket_handle_new_client
> - _socket_handle_client_data
>
> 2. I removed the socket_send_nowait prototype from the header, and
> commented it out in the implementation file.  I was tempted to
> eliminate it entirely, but stayed my hand.  It is a trivial wrapper
> for _socket_send(), and nothing calls it.
>
> 3. Nothing calls several other functions either.  However unlike
> socket_send_nowait() they are non-trivial functions, and they appear
> to be intended for external linkage, so I left them alone for
> potential future use:
>
> - socket_open_udp_server
> - socket_open_unix_server
> - socket_open_udp_client
> - socket_connected
>
> 4. The identifier _socket_print_list is reserved for local scope,
> and should not have external linkage, because it starts with an
> underscore followed by a lower case letter.  I may submit a patch to
> rename it some day if I ever get around to it, but that will require
> a change in socket_test.c, which calls it.
>
> 5. I moved the definition of the RBUFSIZE macro from the header file
> into the implmentation file.  It is an internal detail that no
> other translation unit should know or care about.
>
> ------------------------------
>
> Some of my choices may be mistakes, from not knowing about future
> directions.  However everything in this patch can be readily undone.
>
> Scott McKellar
> http://home.swbell.net/mck9/aargh
>
> Developer's Certificate of Origin 1.1 By making a contribution to
> this project, I certify that:
>
> (a) The contribution was created in whole or in part by me and I
> have the right to submit it under the open source license indicated
> in the file; or
>
> (b) The contribution is based upon previous work that, to the best
> of my knowledge, is covered under an appropriate open source license
> and I have the right under that license to submit that work with
> modifications, whether created in whole or in part by me, under the
> same open source license (unless I am permitted to submit under a
> different license), as indicated in the file; or
>
> (c) The contribution was provided directly to me by some other person
> who certified (a), (b) or (c) and I have not modified it; and
>
> (d) In the case of each of (a), (b), or (c), I understand and agree
> that this project and the contribution are public and that a record
> of the contribution (including all personal information I submit
> with it, including my sign-off) is maintained indefinitely and may
> be redistributed consistent with this project or the open source
> license indicated in the file.
>


-- 
Mike Rylander


More information about the Open-ils-dev mailing list