Ruby
1.9.3p448(2013-06-27revision41675)
|
#include "ruby/config.h"
#include "ruby/defines.h"
#include "sdbm.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | BYTESIZ 8 |
#define | SEEDUPS 1 /* always detect duplicates */ |
#define | BADMESS |
#define | debug(x) |
#define | GET_SHORT(p, i) ((p)[(i)]) |
#define | PUT_SHORT(p, i, s) ((p)[(i)] = (s)) |
#define | O_BINARY 0 |
#define | EPERM EACCES |
#define | NULL 0 |
#define | bad(x) ((x).dptr == NULL || (x).dsize < 0) |
#define | exhash(item) sdbm_hash((item).dptr, (item).dsize) |
#define | ioerr(db) ((db)->flags |= DBM_IOERR) |
#define | OFF_PAG(off) (long) (off) * PBLKSIZ |
#define | OFF_DIR(off) (long) (off) * DBLKSIZ |
#define | exhash(item) sdbm_hash((item).dptr, (item).dsize) |
Functions | |
static int fitpair | proto ((char *, int)) |
static void putpair | proto ((char *, datum, datum)) |
static datum getpair | proto ((char *, datum)) |
static int chkpage | proto ((char *)) |
static void splpage | proto ((char *, char *, long)) |
static int getdbit | proto ((DBM *, long)) |
static datum getnext | proto ((DBM *)) |
static int makroom | proto ((DBM *, long, int)) |
DBM * | sdbm_open (register char *file, register int flags, register int mode) |
DBM * | sdbm_prep (char *dirname, char *pagname, int flags, int mode) |
void | sdbm_close (register DBM *db) |
datum | sdbm_fetch (register DBM *db, datum key) |
int | sdbm_delete (register DBM *db, datum key) |
int | sdbm_store (register DBM *db, datum key, datum val, int flags) |
static int | makroom (register DBM *db, long int hash, int need) |
datum | sdbm_firstkey (register DBM *db) |
datum | sdbm_nextkey (register DBM *db) |
static int | getpage (register DBM *db, register long int hash) |
static int | getdbit (register DBM *db, register long int dbit) |
static int | setdbit (register DBM *db, register long int dbit) |
static datum | getnext (register DBM *db) |
static int seepair | proto ((char *, int, char *, int)) |
static int | fitpair (char *pag, int need) |
static void | putpair (char *pag, datum key, datum val) |
static datum | getpair (char *pag, datum key) |
static int | duppair (char *pag, datum key) |
static datum | getnkey (char *pag, int num) |
static int | delpair (char *pag, datum key) |
static int | seepair (char *pag, register int n, register char *key, register int siz) |
static void | splpage (char *pag, char *new, long int sbit) |
static int | chkpage (char *pag) |
long | sdbm_hash (register char *str, register int len) |
Variables | |
int | errno |
static long | masks [] |
datum | nullitem = {NULL, 0} |
#define bad | ( | x | ) | ((x).dptr == NULL || (x).dsize < 0) |
Definition at line 129 of file _sdbm.c.
Referenced by get_addr(), getaddrinfo(), rb_cstr_to_dbl(), rb_cstr_to_inum(), sdbm_delete(), sdbm_fetch(), sdbm_store(), and syck_hdlr_add_anchor().
#define BADMESS |
#define BYTESIZ 8 |
Definition at line 29 of file _sdbm.c.
Referenced by getdbit(), sdbm_prep(), and setdbit().
#define debug | ( | x | ) |
#define EPERM EACCES |
Definition at line 98 of file _sdbm.c.
Referenced by fdbm_store(), fgdbm_store(), fsdbm_store(), kill(), p_gid_change_privilege(), p_gid_switch(), p_uid_change_privilege(), p_uid_switch(), sdbm_delete(), and sdbm_store().
#define exhash | ( | item | ) | sdbm_hash((item).dptr, (item).dsize) |
Definition at line 615 of file _sdbm.c.
Referenced by sdbm_delete(), sdbm_fetch(), sdbm_store(), and splpage().
#define ioerr | ( | db | ) | ((db)->flags |= DBM_IOERR) |
Definition at line 131 of file _sdbm.c.
Referenced by getnext(), sdbm_delete(), sdbm_fetch(), sdbm_firstkey(), and sdbm_store().
#define NULL 0 |
Definition at line 107 of file _sdbm.c.
Referenced by getnext(), sdbm_close(), sdbm_delete(), sdbm_fetch(), sdbm_firstkey(), sdbm_nextkey(), sdbm_open(), sdbm_prep(), and sdbm_store().
#define O_BINARY 0 |
Definition at line 93 of file _sdbm.c.
Referenced by copy_stream_body(), do_writeconv(), Init_IO(), init_stdhandle(), io_s_write(), load_file_internal(), prep_io(), rb_io_binmode(), rb_io_extract_modeenc(), rb_io_fmode_oflags(), rb_io_oflags_fmode(), rb_io_s_pipe(), rb_w32_accept(), rb_w32_open(), rb_w32_socket(), rb_w32_socketpair(), rb_w32_wopen(), and sdbm_prep().
Definition at line 133 of file _sdbm.c.
Referenced by getnext(), getpage(), makroom(), sdbm_delete(), sdbm_firstkey(), and sdbm_store().
|
static |
|
static |
Definition at line 736 of file _sdbm.c.
References debug, datum::dptr, datum::dsize, GET_SHORT, i, memmove(), PBLKSIZ, PRIdPTRDIFF, PUT_SHORT, and seepair().
Referenced by sdbm_delete(), and sdbm_store().
|
static |
Definition at line 708 of file _sdbm.c.
References datum::dptr, datum::dsize, GET_SHORT, and seepair().
Referenced by sdbm_store().
|
static |
Definition at line 568 of file _sdbm.c.
References DBM::blkptr, chkpage(), datum::dptr, getnkey(), ioerr, key, DBM::keyptr, NULL, nullitem, OFF_PAG, DBM::pagbno, DBM::pagbuf, DBM::pagf, PBLKSIZ, and SEEK_SET.
Referenced by sdbm_firstkey(), and sdbm_nextkey().
|
static |
Definition at line 717 of file _sdbm.c.
References datum::dptr, datum::dsize, GET_SHORT, key, and PBLKSIZ.
Referenced by getnext().
Definition at line 471 of file _sdbm.c.
References chkpage(), DBM::curbit, debug, getdbit(), DBM::hmask, long, OFF_PAG, DBM::pagbno, DBM::pagbuf, DBM::pagf, PBLKSIZ, and SEEK_SET.
Referenced by sdbm_delete(), sdbm_fetch(), and sdbm_store().
Definition at line 688 of file _sdbm.c.
References datum::dptr, datum::dsize, GET_SHORT, i, and seepair().
Referenced by sdbm_fetch().
Definition at line 344 of file _sdbm.c.
References DBM::curbit, debug, fitpair(), DBM::hmask, OFF_PAG, DBM::pagbno, DBM::pagbuf, DBM::pagf, PBLKSIZ, SEEK_END, SEEK_SET, setdbit(), splpage(), and SPLTMAX.
Referenced by sdbm_store().
|
static |
|
static |
Definition at line 660 of file _sdbm.c.
References datum::dptr, datum::dsize, GET_SHORT, PBLKSIZ, and PUT_SHORT.
Referenced by sdbm_store(), and splpage().
void sdbm_close | ( | register DBM * | db | ) |
Definition at line 238 of file _sdbm.c.
References DBM::dirf, free(), NULL, and DBM::pagf.
Referenced by free_sdbm(), and fsdbm_close().
Definition at line 262 of file _sdbm.c.
References bad, delpair(), EPERM, exhash, getpage(), ioerr, NULL, OFF_PAG, DBM::pagbno, DBM::pagbuf, DBM::pagf, PBLKSIZ, sdbm_rdonly, and SEEK_SET.
Referenced by fsdbm_clear(), fsdbm_delete(), fsdbm_delete_if(), and fsdbm_shift().
Definition at line 250 of file _sdbm.c.
References bad, exhash, getpage(), getpair(), ioerr, NULL, nullitem, and DBM::pagbuf.
Referenced by fsdbm_delete(), fsdbm_delete_if(), fsdbm_each_pair(), fsdbm_each_value(), fsdbm_fetch(), fsdbm_has_key(), fsdbm_has_value(), fsdbm_invert(), fsdbm_key(), fsdbm_select(), fsdbm_shift(), fsdbm_to_a(), fsdbm_to_hash(), and fsdbm_values().
Definition at line 441 of file _sdbm.c.
References DBM::blkptr, getnext(), ioerr, DBM::keyptr, NULL, nullitem, OFF_PAG, DBM::pagbno, DBM::pagbuf, DBM::pagf, PBLKSIZ, and SEEK_SET.
Referenced by fsdbm_clear(), fsdbm_delete_if(), fsdbm_each_key(), fsdbm_each_pair(), fsdbm_each_value(), fsdbm_empty_p(), fsdbm_has_value(), fsdbm_invert(), fsdbm_key(), fsdbm_keys(), fsdbm_length(), fsdbm_select(), fsdbm_shift(), fsdbm_to_a(), fsdbm_to_hash(), and fsdbm_values().
Definition at line 460 of file _sdbm.c.
References getnext(), NULL, and nullitem.
Referenced by fsdbm_delete_if(), fsdbm_each_key(), fsdbm_each_pair(), fsdbm_each_value(), fsdbm_empty_p(), fsdbm_has_value(), fsdbm_invert(), fsdbm_key(), fsdbm_keys(), fsdbm_length(), fsdbm_select(), fsdbm_to_a(), fsdbm_to_hash(), and fsdbm_values().
DBM* sdbm_open | ( | register char * | file, |
register int | flags, | ||
register int | mode | ||
) |
Definition at line 153 of file _sdbm.c.
References DIRFEXT, free(), malloc(), NULL, PAGFEXT, sdbm_prep(), and strlen().
Referenced by fsdbm_initialize().
DBM* sdbm_prep | ( | char * | dirname, |
char * | pagname, | ||
int | flags, | ||
int | mode | ||
) |
Definition at line 182 of file _sdbm.c.
References DBM::blkptr, BYTESIZ, DBLKSIZ, DBM_RDONLY, DBM::dirbno, DBM::dirbuf, DBM::dirf, DBM::flags, free(), fstat, DBM::hmask, DBM::keyptr, long, malloc(), DBM::maxbno, NULL, O_BINARY, DBM::pagbno, DBM::pagbuf, DBM::pagf, PBLKSIZ, and stat.
Referenced by sdbm_open().
Definition at line 286 of file _sdbm.c.
References bad, DBM_REPLACE, delpair(), datum::dsize, duppair(), EPERM, exhash, fitpair(), getpage(), hash(), ioerr, makroom(), NULL, OFF_PAG, DBM::pagbno, DBM::pagbuf, DBM::pagf, PAIRMAX, PBLKSIZ, putpair(), sdbm_rdonly, and SEEK_SET.
Referenced by fsdbm_store().
|
static |
Definition at line 534 of file _sdbm.c.
References BYTESIZ, DBLKSIZ, debug, DBM::dirbno, DBM::dirbuf, DBM::dirf, long, DBM::maxbno, OFF_DIR, and SEEK_SET.
Referenced by makroom().
|
static |
int errno |
Referenced by argf_next_argv(), atanh(), BigDecimal_to_f(), call_asynchronous(), check_spawn_mode(), copy_stream_finalize(), CreateChild(), date_strftime_alloc(), date_strftime_with_tmx(), dir_initialize(), dir_read(), dln_load(), do_lstat(), do_opendir(), do_select(), do_stat(), dup2(), establishShell(), fcntl(), fdbm_store(), fgdbm_store(), fill_standard_fds(), finish_overlapped_socket(), finish_writeconv(), flock_winnt(), flush_before_seek(), fptr_finalize(), fsdbm_store(), function_call(), get_wsa_extension_function(), iconv_create(), iconv_try(), io_binwrite(), io_flush_buffer_sync(), io_getpartial(), io_reopen(), io_unread(), ioctl(), kill(), lgamma_r(), make_errno_exc(), make_errno_exc_str(), maygvl_copy_stream_continue_p(), maygvl_copy_stream_read(), maygvl_copy_stream_wait_read(), nogvl_copy_stream_read_write(), nogvl_copy_stream_wait_write(), nogvl_copy_stream_write(), open_dir_handle(), opendir_internal(), ossl_pkey_new_from_file(), ossl_ssl_write_internal(), ossl_start_ssl(), ossl_x509_new_from_file(), overlapped_socket_io(), p_gid_change_privilege(), p_gid_switch(), p_uid_change_privilege(), p_uid_switch(), pack_pack(), pack_unpack(), parser_yylex(), pipe_open(), poll_child_status(), proc_exec_v(), proc_waitall(), rb_chsize(), rb_cloexec_fcntl_dupfd(), rb_cstr_to_dbl(), rb_dlcfunc_call(), rb_fdopen(), rb_file_flock(), rb_file_s_rename(), rb_iconv_sys_fail(), rb_io_each_byte(), rb_io_rewind(), rb_io_seek(), rb_io_set_pos(), rb_io_sysseek(), rb_io_tell(), rb_io_wait_readable(), rb_io_wait_writable(), rb_io_write_nonblock(), rb_load_fail(), rb_maygvl_fd_fix_cloexec(), rb_pipe(), rb_proc_exec(), rb_strftime_alloc(), rb_strftime_with_timespec(), rb_sys_warning(), rb_sysopen(), rb_syswait(), rb_thread_blocking_region(), rb_thread_blocking_region_end(), rb_thread_flock(), rb_thread_io_blocking_region(), rb_update_max_fd(), rb_w32_accept(), rb_w32_access(), rb_w32_asynchronize(), rb_w32_bind(), rb_w32_close(), rb_w32_connect(), rb_w32_fclose(), rb_w32_getc(), rb_w32_getcwd(), rb_w32_gethostbyaddr(), rb_w32_gethostbyname(), rb_w32_gethostname(), rb_w32_getpeername(), rb_w32_getprotobyname(), rb_w32_getprotobynumber(), rb_w32_getservbyname(), rb_w32_getservbyport(), rb_w32_getsockname(), rb_w32_getsockopt(), rb_w32_ioctlsocket(), rb_w32_isatty(), rb_w32_listen(), rb_w32_open_osfhandle(), rb_w32_pipe(), rb_w32_read(), rb_w32_select_with_thread(), rb_w32_setsockopt(), rb_w32_shutdown(), rb_w32_socket(), rb_w32_truncate(), rb_w32_uaccess(), rb_w32_wopen(), rb_w32_write(), rb_wait_for_single_fd(), rb_waitpid(), readline_readline(), realpath_rec(), recvmsg(), rsock_connect(), rsock_s_accept(), rsock_s_accept_nonblock(), rsock_s_recvfrom_nonblock(), rsock_socket(), ruby_close(), ruby_dup(), ruby_getcwd(), ruby_getpeername(), ruby_getsockname(), ruby_setenv(), ruby_shutdown(), ruby_strtod(), ruby_strtoul(), save_redirect_fd(), select_single(), sendmsg(), setup_overlapped(), sock_connect_nonblock(), socketpair_internal(), strio_init(), sys_warning_1(), tgamma(), ttymode(), wait_connectable(), waitpid(), winnt_stat(), wlink(), wmkdir(), wrename(), wrmdir(), wstati64(), wunlink(), and wutime().
|
static |
Definition at line 150 of file _sdbm.c.
Referenced by getnext(), sdbm_fetch(), sdbm_firstkey(), and sdbm_nextkey().