zoukankan      html  css  js  c++  java
  • nginx 源码阅读 core

    ngx_config.h

    数据对齐

    #define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))

    ngx_core.h

    #define ngx_abs(value) (((value) >= 0) ? (value) : - (value))

    #define ngx_max(val1, val2) ((val1 < val2) ? (val2) : (val1))

    #define ngx_min(val1, val2) ((val1 > val2) ? (val2) : (val1))

    数据结构

    ngx_array

    typedef struct {
    void *elts;
    ngx_uint_t nelts;
    size_t size;
    ngx_uint_t nalloc;
    ngx_pool_t *pool;
    } ngx_array_t;

    ngx_palloc.h

    内存池


    typedef struct ngx_pool_cleanup_s ngx_pool_cleanup_t;

    struct ngx_pool_cleanup_s {
    ngx_pool_cleanup_pt handler;
    void *data;
    ngx_pool_cleanup_t *next;
    };


    typedef struct ngx_pool_large_s ngx_pool_large_t;

    struct ngx_pool_large_s {
    ngx_pool_large_t *next;
    void *alloc;
    };


    typedef struct {
    u_char *last;
    u_char *end;
    ngx_pool_t *next;
    ngx_uint_t failed;
    } ngx_pool_data_t;


    struct ngx_pool_s {
    ngx_pool_data_t d;
    size_t max;
    ngx_pool_t *current;
    ngx_chain_t *chain;
    ngx_pool_large_t *large;
    ngx_pool_cleanup_t *cleanup;
    ngx_log_t *log;
    };

  • 相关阅读:
    列表、元组、字符串的相互转化
    python中的常用BIF
    python中的类型
    python内置模块
    打印字体颜色整理
    xml操作
    内置函数
    迭代器
    装饰器
    函数
  • 原文地址:https://www.cnblogs.com/andyhe/p/3213891.html
Copyright © 2011-2022 走看看