Tree @release-1.12.0 (Download .tar.gz)
- ..
- nginx.c
- nginx.h
- ngx_array.c
- ngx_array.h
- ngx_buf.c
- ngx_buf.h
- ngx_conf_file.c
- ngx_conf_file.h
- ngx_config.h
- ngx_connection.c
- ngx_connection.h
- ngx_core.h
- ngx_cpuinfo.c
- ngx_crc.h
- ngx_crc32.c
- ngx_crc32.h
- ngx_crypt.c
- ngx_crypt.h
- ngx_cycle.c
- ngx_cycle.h
- ngx_file.c
- ngx_file.h
- ngx_hash.c
- ngx_hash.h
- ngx_inet.c
- ngx_inet.h
- ngx_list.c
- ngx_list.h
- ngx_log.c
- ngx_log.h
- ngx_md5.c
- ngx_md5.h
- ngx_module.c
- ngx_module.h
- ngx_murmurhash.c
- ngx_murmurhash.h
- ngx_open_file_cache.c
- ngx_open_file_cache.h
- ngx_output_chain.c
- ngx_palloc.c
- ngx_palloc.h
- ngx_parse.c
- ngx_parse.h
- ngx_parse_time.c
- ngx_parse_time.h
- ngx_proxy_protocol.c
- ngx_proxy_protocol.h
- ngx_queue.c
- ngx_queue.h
- ngx_radix_tree.c
- ngx_radix_tree.h
- ngx_rbtree.c
- ngx_rbtree.h
- ngx_regex.c
- ngx_regex.h
- ngx_resolver.c
- ngx_resolver.h
- ngx_rwlock.c
- ngx_rwlock.h
- ngx_sha1.c
- ngx_sha1.h
- ngx_shmtx.c
- ngx_shmtx.h
- ngx_slab.c
- ngx_slab.h
- ngx_spinlock.c
- ngx_string.c
- ngx_string.h
- ngx_syslog.c
- ngx_syslog.h
- ngx_thread_pool.c
- ngx_thread_pool.h
- ngx_times.c
- ngx_times.h
ngx_list.h @release-1.12.0 — raw · history · blame
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#ifndef _NGX_LIST_H_INCLUDED_
#define _NGX_LIST_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
typedef struct ngx_list_part_s ngx_list_part_t;
struct ngx_list_part_s {
void *elts;
ngx_uint_t nelts;
ngx_list_part_t *next;
};
typedef struct {
ngx_list_part_t *last;
ngx_list_part_t part;
size_t size;
ngx_uint_t nalloc;
ngx_pool_t *pool;
} ngx_list_t;
ngx_list_t *ngx_list_create(ngx_pool_t *pool, ngx_uint_t n, size_t size);
static ngx_inline ngx_int_t
ngx_list_init(ngx_list_t *list, ngx_pool_t *pool, ngx_uint_t n, size_t size)
{
list->part.elts = ngx_palloc(pool, n * size);
if (list->part.elts == NULL) {
return NGX_ERROR;
}
list->part.nelts = 0;
list->part.next = NULL;
list->last = &list->part;
list->size = size;
list->nalloc = n;
list->pool = pool;
return NGX_OK;
}
/*
*
* the iteration through the list:
*
* part = &list.part;
* data = part->elts;
*
* for (i = 0 ;; i++) {
*
* if (i >= part->nelts) {
* if (part->next == NULL) {
* break;
* }
*
* part = part->next;
* data = part->elts;
* i = 0;
* }
*
* ... data[i] ...
*
* }
*/
void *ngx_list_push(ngx_list_t *list);
#endif /* _NGX_LIST_H_INCLUDED_ */
|