Граф коммитов

12 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 61289d9405
Initialize loop variable of `ccan_list_for_each`
On platforms where `typeof` is unsupported, `ccan_container_off_var`
calculates the offset of member by pointer subtraction.  Although this
will result in the compile-time invariant value regardless the pointer
value, the loop variable will be used before assignment and may cause
an using uninitialized variable warning.
2023-12-24 19:34:25 +09:00
Nobuyoshi Nakada a14611cd54 Fix -Wundef warnings 2022-10-26 18:57:26 +09:00
Nobuyoshi Nakada 42a0bed351
Prefix ccan headers (#4568)
* Prefixed ccan headers

* Remove unprefixed names in ccan/build_assert

* Remove unprefixed names in ccan/check_type

* Remove unprefixed names in ccan/container_of

* Remove unprefixed names in ccan/list

Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2022-03-30 20:36:31 +13:00
wonda-tea-coffee ad108e63e3 [Doc] Fix a typo s/oher/other/ 2021-04-25 19:46:00 +12:00
Kazuhiro NISHIYAMA ede1a3dc11
Fix typos [ci skip] 2019-10-14 17:30:04 +09:00
normal 7af65953de ccan/list: sync with upstream
This brings us up-to-date with ccan/list
5dbd87b876434dd703dfcc30cb0503118aac2076
git://git.ozlabs.org/~ccan/ccan

This is a combination of 3 commits from ccan:

    list: add parens to gaurd macro args in LIST_INIT
    ccan/list: Add list_empty_nocheck
    list: trivial: fix typos in list_for_each_off's documentation

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-01 08:59:27 +00:00
normal 1fab35ba15 ccan/list/list.h: suppress unused argument warnings
ccan commit 6aaca17e07588997417a73fac19dcf0ff17ed81b
("list: suppress unused argument warnings")
by Cody P Shafer.

Signed-off-by: Cody P Schafer <dev@codyps.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-06 07:10:54 +00:00
normal 9177eca302 ccan/list/list.h: sync with ccan upstream
This includes the following 5 commits from ccan upstream:

    list: list_add_after and list_add_before functions
    list: list_swap to exchange elements
    list: new list_for_each{, _safe}_off_dir_ macros
    list: add list_for_each_rev_off macro
    list: add list_for_each_rev_safe{,_off} macros

This syncs us with commit c2fbfe5282ba264f3485586e7efa8a5967f2d386
in git://git.ozlabs.org/~ccan/ccan

These ccan commits should allow us to implement compile.c and
st.c using ccan/list to reduce duplicated linked-list logic.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-09 00:30:26 +00:00
normal e7f6d9e25a ccan/container_of: add container_of_or_null
* ccan/container_of/container_of.h (container_of_or_null): added
  [ccan 7ec5b8e06b2fd5fa98b1fcde1158c286d2d429d8] (David Gibson)

It's quite common to have a pointer which could be either a pointer to a
structure member, or NULL.  This needs special casing with container_of(),
or it will convert NULL into something strange.

This patch adds container_of_or_null(), which will return NULL if passed
(an appropriately typed) NULL, or the containining structure as
container_of() otherwise.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-13 23:49:28 +00:00
normal c975dc96b7 ccan/list: new list_{del,node}_init functions
* ccan/list/list.h (list_del_init, list_node_init): new functions
  for multiple list_del() calls
  [ccan ec8654d94d3c5c47aa5f82698f7e8048c79765b1] (Rusty Russell)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-13 23:49:15 +00:00
normal 57c9c3189a ccan/container_of/container_of.h: avoid warning with -Wcast-qual
* ccan/container_of/container_of.h (container_off_var):
  avoid warning with -Wcast-qual
  [ccan ba5ad771af4aa9e085498de6c3c665c52694460f (Rusty Russell)]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-25 06:55:10 +00:00
normal f11db2a605 vm*: doubly-linked list from ccan to manage vm->living_threads
A doubly-linked list for tracking living threads guarantees
constant-time insert/delete performance with no corner cases of a
hash table.  I chose this ccan implementation of doubly-linked
lists over the BSD sys/queue.h implementation since:

1) insertion and removal are both branchless
2) locality is improved if a struct may be a member of multiple lists
   (0002 patch in Feature 9632 will introduce a secondary list
   for waiting FDs)

This also increases cache locality during iteration: improving
performance in a new IO#close benchmark with many sleeping threads
while still scanning the same number of threads.

	vm_thread_close 1.762

* vm_core.h (rb_vm_t): list_head and counter for living_threads
  (rb_thread_t): vmlt_node for living_threads linkage
  (rb_vm_living_threads_init): new function wrapper
  (rb_vm_living_threads_insert): ditto
  (rb_vm_living_threads_remove): ditto
* vm.c (rb_vm_living_threads_foreach): new function wrapper
* thread.c (terminate_i, thread_start_func_2, thread_create_core,
  thread_fd_close_i, thread_fd_close): update to use new APIs
* vm.c (vm_mark_each_thread_func, rb_vm_mark, ruby_vm_destruct,
  vm_memsize, vm_init2, Init_VM): ditto
* vm_trace.c (clear_trace_func_i, rb_clear_trace_func): ditto
* benchmark/bm_vm_thread_close.rb: added to show improvement
* ccan/build_assert/build_assert.h: added as a dependency of list.h
* ccan/check_type/check_type.h: ditto
* ccan/container_of/container_of.h: ditto
* ccan/licenses/BSD-MIT: ditto
* ccan/licenses/CC0: ditto
* ccan/str/str.h: ditto (stripped of unused macros)
* ccan/list/list.h: ditto
* common.mk: add CCAN_LIST_INCLUDES
  [ruby-core:61871][Feature 9632 (part 1)]

Apologies for the size of this commit, but I think a good
doubly-linked list will be useful for future features, too.
This may be used to add ordering to a container_of-based hash
table to preserve compatibility if required (e.g. feature 9614).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10 23:48:51 +00:00