[PATCH 00/18] Improve use of 'inline'

Alejandro Colomar alx.manpages at gmail.com
Thu Jun 2 18:04:54 UTC 2022


Hi!

As I explained the previous emails, I was concerned about the use
of inline in Unit.  This patch set attempts to fix that (and a few
other related minor issues that make sense together in this patch
set).  Performance should be kept the same, or even improved in
some cases, but that's just a guess, and no performance tests have
been done.  The only tests I've run are the normal pytests to
check I didn't break anything.

Cheers!

Alex


Alejandro Colomar (18):
  Put function attributes where C2x specifies.
  Added nxt_always_inline attribute.
  Replaced nxt_inline in .c files by static inline.
  Removed superfluous 'static' keyword from always_inline functions.
  Added auto/cflags, with a test for -fno-gnu89-inline.
  Requiring C99 inline.
  Replaced nxt_inline in .h files by inline.
  Removed nxt_always_inline from nxt_array_remove_last().
  Removed nxt_always_inline from nxt_h1p_request_error().
  Removed nxt_always_inline from nxt_perl_psgi_cb_request_done().
  Removed nxt_always_inline from nxt_port_close_fds().
  Removed nxt_always_inline from (NXT_AIX) nxt_thread_get_tid().
  Removed nxt_always_inline from nxt_unit_close().
  Removed nxt_always_inline from nxt_unit_process_release().
  Fixed static and static inline in a header to be C99 inline.
  Fixed static and static inline in a header to be C99 inline.
  Added const to a constant variable.
  Added extern version of C99 inline function.

 auto/cflags                   | 23 +++++++++++
 auto/clang                    | 26 +++++++++++-
 auto/sources                  |  3 ++
 configure                     |  1 +
 src/nxt_app_nncq.c            | 29 +++++++++++++
 src/nxt_app_nncq.h            | 24 +++++------
 src/nxt_app_queue.h           | 15 ++++---
 src/nxt_application.c         |  3 +-
 src/nxt_array.c               |  3 ++
 src/nxt_array.h               |  5 ++-
 src/nxt_atomic.h              |  9 ++--
 src/nxt_buf.c                 |  3 ++
 src/nxt_buf.h                 | 12 ++++--
 src/nxt_buf_filter.c          |  4 +-
 src/nxt_cache.c               |  6 ++-
 src/nxt_clang.h               |  5 ++-
 src/nxt_conf.c                |  3 +-
 src/nxt_conf_validation.c     |  8 ++--
 src/nxt_event_engine.h        |  3 +-
 src/nxt_external.c            |  3 +-
 src/nxt_fastcgi_source.c      |  3 +-
 src/nxt_h1proto.c             |  4 +-
 src/nxt_hash.h                |  9 ++--
 src/nxt_http.h                | 12 +++---
 src/nxt_http_parse.c          |  3 +-
 src/nxt_http_parse.h          |  3 +-
 src/nxt_http_source.c         |  3 +-
 src/nxt_isolation.c           |  5 ++-
 src/nxt_list.h                |  6 ++-
 src/nxt_malloc.h              | 12 ++----
 src/nxt_mem_zone.c            |  3 +-
 src/nxt_mem_zone.h            |  9 ++--
 src/nxt_mp.c                  |  9 ++--
 src/nxt_mp.h                  | 28 +++++--------
 src/nxt_nncq.c                | 23 +++++++++++
 src/nxt_nncq.h                | 24 +++++------
 src/nxt_openssl.c             |  3 +-
 src/nxt_php_sapi.c            | 16 ++++----
 src/nxt_port.c                |  3 +-
 src/nxt_port.h                |  6 ++-
 src/nxt_port_hash.c           |  3 +-
 src/nxt_port_memory.c         |  3 +-
 src/nxt_port_memory_int.h     | 30 +++++++++-----
 src/nxt_port_queue.h          |  9 ++--
 src/nxt_port_rpc.c            |  6 ++-
 src/nxt_port_socket.c         |  9 ++--
 src/nxt_random.c              |  8 ++--
 src/nxt_rbtree.c              | 14 ++++---
 src/nxt_rbtree.h              |  6 ++-
 src/nxt_router.c              | 21 ++++++----
 src/nxt_runtime.c             |  3 +-
 src/nxt_sockaddr.h            | 19 ++++-----
 src/nxt_socket_msg.h          |  9 ++--
 src/nxt_string.h              |  3 +-
 src/nxt_thread_id.c           |  5 +++
 src/nxt_thread_id.h           | 23 +++++++----
 src/nxt_thread_log.h          |  3 +-
 src/nxt_timer.h               |  3 +-
 src/nxt_unit.c                | 77 +++++++++++++++++++----------------
 src/nxt_unit.h                |  8 ++--
 src/nxt_utf8.h                |  3 +-
 src/nxt_var.h                 |  3 +-
 src/nxt_vector.h              |  3 +-
 src/nxt_websocket.c           | 12 ++++--
 src/nxt_work_queue.c          |  3 +-
 src/perl/nxt_perl_psgi.c      | 23 ++++++-----
 src/ruby/nxt_ruby.c           |  6 +--
 src/ruby/nxt_ruby_stream_io.c |  5 ++-
 src/test/nxt_rbtree1.c        | 14 ++++---
 src/test/nxt_rbtree1.h        |  3 +-
 src/test/nxt_rbtree1_test.c   |  6 ++-
 src/test/nxt_tests.h          |  3 +-
 72 files changed, 463 insertions(+), 255 deletions(-)
 create mode 100644 auto/cflags
 create mode 100644 src/nxt_app_nncq.c
 create mode 100644 src/nxt_nncq.c
 create mode 100644 src/nxt_thread_id.c

-- 
2.36.1



More information about the unit mailing list