summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-socket/src/socket.c
AgeCommit message (Collapse)Author
2021-12-28Fix build error and refine definition of `ssize_t` on MSVC.mimaki
2021-09-20Update `struct` initializer to work with relatively older `C++`.Yukihiro "Matz" Matsumoto
2021-09-15Use `struct` initializer instead of `memset`.Yukihiro "Matz" Matsumoto
2021-07-25Remove redundant include headers.Yukihiro "Matz" Matsumoto
- stdlib.h - stddef.h - stdint.h - stdarg.h - limits.h - float.h
2021-05-17Rename `mrb_fixnum_to_str` to `mrb_integer_to_str`.Yukihiro "Matz" Matsumoto
2021-05-05Extend the tab with 8 whitespacedearblue
This work was done as follows: - check: `git grep $'\011' -- :^oss-fuzz` - convert: `ruby -pi -e 'nil while $_.sub!(/^(.*?)\t/) { $1 + " " * (8 - $1.size % 8) }'` The `doc/guide/{compile,mrbgems}.md` file adds and removes whitespace to make the directory tree look the same. In `mrbgems/mruby-socket/src/socket.c`, there is a part where the indent is changed from 4 to 2 at the same time as the tab is changed.
2021-01-26Revert "Minimize the changes in #5277"Yukihiro "Matz" Matsumoto
This reverts commit dc51d89ac22acc60b9bfeed87115863565b74085.
2021-01-22Minimize the changes in #5277Yukihiro "Matz" Matsumoto
Instead of including `mruby/presym.h` everywhere, we provided the fallback `mruby/presym.inc` under `include/mruby` directory, and specify `-I<build-dir>/include` before `-I<top-dir>/include` in `presym.rake`. So even when someone drops `-I<build-dir>/include` in compiler options, it just compiles without failure.
2021-01-11Avoid including `presym.inc` in existing header filesKOBAYASHI Shuji
Addressed an issue where existing programs linking `libmruby.a` could only be built by adding `<build-dir>/include` to compiler's include path.
2020-11-22Remove `mrb_str_buf_new()` and `MRB_STR_BUF_MIN_SIZE`; close #5171Yukihiro "Matz" Matsumoto
2020-11-13Change name and usage of presym macrosKOBAYASHI Shuji
To be also able to build mruby without presym in the future. However, `MRB_QSYM` has been removed and changed as follows: ### Example | Type | Symbol | Previous Style | New Style | |---------------------------|--------|------------------|----------------| | Operator | & | MRB_QSYM(and) | MRB_OPSYM(and) | | Class Variable | @@foo | MRB_QSYM(00_foo) | MRB_CVSYM(foo) | | Instance Variable | @foo | MRB_QSYM(0_foo) | MRB_IVSYM(foo) | | Method with Bang | foo! | MRB_QSYM(foo_b) | MRB_SYM_B(foo) | | Method with Question mark | foo? | MRB_QSYM(foo_p) | MRB_SYM_Q(foo) | | Mmethod with Equal | foo= | MRB_QSYM(foo_e) | MRB_SYM_E(foo) | This change makes it possible to define, for example, `MRB_IVSYM(foo)` as `mrb_intern_lit(mrb, "@" "foo")`, which is useful if we support building without presym in the future.
2020-10-12Use `mrb_int_value()` instead of `mrb_fixnum_value()`.Yukihiro "Matz" Matsumoto
Where fixnum overflow can happen.
2020-10-12Reorganize `Integer` system.Yukihiro "Matz" Matsumoto
- Integrate `Fixnum` and `Integer` - Remove `Integral` - `int / int -> int` - Replace `mrb_fixnum()` to `mrb_int()` - Replace `mrb_fixnum_value()` to `mrb_int_value()`. - Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
2020-10-12Integrate `Fixnum` class into `Integer` classdearblue
* The `Fixnum` constant is now an alias for the `Integer` class. * Remove `struct mrb_state::fixnum_class` member. If necessary, use `struct mrb_state::integer_class` instead.
2020-10-12Generate C struct from `irep` instead of binary dump.Yukihiro "Matz" Matsumoto
2020-10-12Use functions that take symbols to reduce string litrals in C.Yukihiro "Matz" Matsumoto
2020-10-12Use `mrb_funcall_id()` extensively.Yukihiro "Matz" Matsumoto
Except for support files e.g. `mruby-test/driver.c`, which are not target of symbol collection via `rake gensym`.
2020-10-12Add `MRB_SYM()` for inline symbols.Yukihiro "Matz" Matsumoto
2020-09-25Prohibit string changes by "s"/"z" specifier of `mrb_get_args()`dearblue
- The `s` specifier is a string pointer obtained without performing `mrb_str_modify()`, so it cannot be changed. - The `z` specifier cannot be changed because it is a string pointer obtained by `RSTRING_CSTR()` which returns `const char *`.
2020-08-09Remove duplicated definition of `E_EOF_ERROR`.Yukihiro "Matz" Matsumoto
2020-01-01Rename `mrb_num_args_error` to `mrb_argnum_error`; ref #4863Yukihiro "Matz" Matsumoto
2019-12-12Add `mrb_num_args_error()` for "wrong number of arguments" errorKOBAYASHI Shuji
To unify the style of messages.
2019-09-26Use type predicate macros instead of `mrb_type` if possibleKOBAYASHI Shuji
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for all `enum mrb_vtype`).
2019-08-07Reorganize `mrb_string_value_cstr` and related functions.Yukihiro "Matz" Matsumoto
`mrb_string_value_cstr` and `mrb_string_value_len`: obsolete `mrb_string_cstr`: new function to retrieve NULL terminated C string `RSTRING_CSTR`: wrapper macro of `mrb_string_cstr`
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-06-18Fix path of `error.h`.Hiroshi Mimaki
2019-05-06Avoid using `mrb_str_to_cstr` if possibleKOBAYASHI Shuji
Because it always allocate new string. Replace with the followings: - Use `RSRING_PTR` if string is guaranteed to be null-terminated. - Use `mrb_string_value_cstr` or `mrb_get_args("z")` if return value isn't modified.
2019-05-05Use `mrb_fixnum_to_str()` instead of `Fixnum#to_s`KOBAYASHI Shuji
2018-11-22Fix mruby-socket test failure on MinGW.Hiroshi Mimaki
2018-08-11Fix misspelling words in commentsKazuhiro Sera
2018-06-15Fixed wrong usages of `mrb_raisef()`; ref #4043Yukihiro "Matz" Matsumoto
`mrb_raisef()` only takes `%S` specifier. If you don't have extra arguments, use `mrb_raise()`.
2018-06-14Resolve sign comparison warning; ref #4044Yukihiro "Matz" Matsumoto
2018-06-14sa_family_t is not defined on windows.Tomoyuki Sahara
2018-06-14set sockaddr_un.sun_len on the systems that have sockaddr.sa_len.Tomoyuki Sahara
If your system has sa_len but is not BSD-derived, define HAVE_SA_LEN=1 on mrbgem.rake or build_config.rb.
2018-06-14struct sockaddr_un can be truncated.Tomoyuki Sahara
When we have "struct sockaddr_un *s_un", we could not assume *s_un points to a memory region which size is at least sizeof(*s_un). Even worse, it may be shorter than sizeof(struct sockaddr) on some systems.
2018-06-14struct sockaddr_un can be shorter than struct sockaddr.Tomoyuki Sahara
ref: https://github.com/iij/mruby-socket/issues/45
2018-06-05Declare inet_ntop and inet_pton as static Sebastián Katzer
To avoid conflicts with multiple definitions of inet_ntop and inet_pton if compiled with # define _WIN32_WINNT _WIN32_WINNT_VISTA C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libWs2_32.a(dghfs00169.o):(.text+0x0): multiple definition of `inet_pton' 722C:/projects/iss/mruby/build/host/lib/libmruby.a(socket.o):C:/projects/iss/mruby/mrbgems/mruby-socket/src/socket.c:80: first defined here define _WIN32_WINNT _WIN32_WINNT_VISTA
2018-04-18Avoid unnecessary object allocation (addrinfo) in `_accept`; ref #3999Yukihiro "Matz" Matsumoto
2018-03-26Revert #3984 .Takeshi Watanabe
2018-03-25Merge commit '36d016afd663d34607c843d03371bedb71efa34e'Takeshi Watanabe
2017-12-14Rename `BasicSocket#is_socket=` to `#_is_socket`; ref #3878Yukihiro "Matz" Matsumoto
2017-12-14Fix socket closing by using `closesocket` API in windows instead.Takeshi Watanabe
2017-12-13Set protocol of AddrInfoHiroshi Mimaki
2017-12-12Winsock uses `int` where UNIX uses `size_t`.Yukihiro "Matz" Matsumoto
2017-12-12fix build on mingwYasuhiro Matsumoto
2017-12-12Winsock does not provide `ssize_t`; Use `int` instead.Yukihiro "Matz" Matsumoto
2017-12-11Reduce VC++ compiler warnings.Yukihiro "Matz" Matsumoto
2017-12-09Reduce VC++ compiler warnings.Yukihiro "Matz" Matsumoto
2017-12-08Reduce VC++ compiler warnings.Yukihiro "Matz" Matsumoto
2017-12-07Remove unused variable `usock` from `mruby-socket/src/socket.c`.Yukihiro "Matz" Matsumoto