亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? mdalloc.c

?? 匯編源代碼大全
?? C
字號(hào):
/*   Written by Blair Haukedal 91/09 and placed in the public domain */

/*  mdalloc - a multi dimensional array allocator
 *  mdfree  - a companion function to mdalloc for freeing storage
 *  synopsis:
 *      void *mdalloc(int ndim, int width, ...);
 *          where:  ndim:   number of array dimensions
 *                  width:  size of elements in array
 *                  variable args are dimensions of array
 *          returns: n-way indirect pointer to allocated storage
 *                   or NULL if insufficient storage
 *
 *      void mdfree(void *p, ndim);
 *          where:  p:      pointer to storage obtained by mdalloc
 *                  ndim:   number of dimensions used in mdalloc
 *
 *  example:
 *      int ***tip;
 *      tip = mdalloc(3, sizeof(int), 2, 3, 4);
 *        tip will be a triple indirect pointer to a 3 dimensional array
 *        tip[0][0][0] refers to the first int in a contiguous area of
 *                     storage that is 2*3*4*sizeof(int) bytes long
 *        tip[0][0] is the address of the first int
 *      memset can be used to initialize array elements as follows:
 *        memset(tip[0][0], 0, 2*3*4*sizeof(int));
 *      mdfree is used to free storage obtained with mdalloc:
 *        mdfree(tip, 3)
 *
 *  notes:
 *      - must be compiled with appropriate memory model
 *      - memory is allocated for each dimension for indirect pointers
 *          eg. 3x4x5 array of longs
 *              (assuming 4 byte longs, small mem model)
 *              p = mdalloc(3, sizeof(long), 3, 4, 5)            - bytes
 *                  3       pointers allocated for 1st dimension -  6
 *                  3x4     pointers allocated for 2nd dimension -  24
 *                  3x4x5   longs allocated for array elements   -  240
 *              total of 270 bytes allocated
 *      - if insufficient memory, nothing will be allocated.
 *          ie. intermediate pointer arrays that were successfully
 *              allocated will be freed.
 *      - the intent of mdalloc is to facilitate dynamic array creation,
 *        it will use more memory than statically declared arrays, and
 *        the required dereferencing will be slower than the use of
 *        statically declared arrays.
 *      - this function assumes that sizeof(char) == 1.
 */

#include <stdarg.h>
#include <stdlib.h>

static void **md2(int n_units, int ndim, int *dims);
static void md3(char ***tip, int n_units, int ndim, int *dims);

static int w_units;

/* mdalloc: entry point for mdalloc function described above
 *      - reduces variable arg list to fixed list with last arg
 *      represented as pointer to int (array dimensions).
 *      Calls md2 to allocate storage.
 *      Calls md3 to initialize intermediate pointers.
 *      Returns pointer.
 */

void *mdalloc(int ndim, int width, ...)
{
      va_list argp;
      int *dims, i;
      char ***tip;

      va_start(argp, width);

      /* allocate storage for variable args (dimensions) */

      dims = malloc(ndim*sizeof(int));
      if(dims == NULL)
            return NULL;

      /* initialize dimensions array for subsequent calls */

      for(i=0; i<ndim; i++)
            dims[i] = va_arg(argp,int);

      w_units = width;    /* global used by md2 and md3 */

      /* allocate required pointer and array element storage */

      tip = (char ***)md2(dims[0], ndim, &dims[1]);

      if(ndim>1 && tip)
            md3(tip, dims[0], ndim-1, &dims[1]); /* init pointers */

      free(dims);
      return tip;
}

/* mdfree:  companion function to mdalloc
 *          frees storage obtained by mdalloc
 */

void mdfree(void *tip, int ndim)
{
      if(ndim == 1)
            free(tip);
      else
      {
            mdfree(((void **)tip)[0], ndim-1);
            free(tip);
      }
}

/* md2:  allocates storage for n-way indirect pointer arrays
 *       allocates storage for requested array elements
 */

static void **md2(int n_units, int ndim, int *dims)
{
      char **tip;

      if(ndim == 1)
            /* recursed to final dimension - allocate element storage */
            tip = malloc(n_units*w_units);
      else
      {
            /* allocate pointer array for dimension n */
            tip = malloc(n_units*sizeof(char *));
            if(tip)
            {
                  /* recurse until final dimension */
                  tip[0] = (char *)md2(n_units*dims[0], ndim-1, &dims[1]);
                  if(tip[0] == NULL)
                  {
                        /* allocate error - fall back up freeing everything */
                        free(tip);
                        tip = NULL;
                  }
            }
      }
      return (void **)tip;
}

/* md3: initializes indirect pointer arrays */

static void md3(char ***tip, int n_units, int ndim, int *dims)
{
      int i;

      for(i=1; i<n_units; i++)
      {
            if(ndim == 1)
                  /* final dimension - must scale by element width */
                  tip[i] = (char **)((char *)tip[0] + i*dims[0]*w_units);
            else
                  /* intermediate dimension - scale by pointer size */
                  tip[i] = tip[0] + i*dims[0];
      }
      if(ndim > 1)
            /* not at final dimension - continue to recurse */
            md3((char ***)tip[0], n_units*dims[0], ndim-1, &dims[1]);
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产不卡视频一区| voyeur盗摄精品| 国产精品久久久久9999吃药| 777a∨成人精品桃花网| 成人高清视频在线| 另类综合日韩欧美亚洲| 一区二区三区日韩在线观看| 久久女同精品一区二区| 欧美日韩精品一区二区三区| 成人久久视频在线观看| 久草在线在线精品观看| 亚洲成人免费视频| 日韩毛片一二三区| 国产精品久久久久久久久晋中 | 综合久久国产九一剧情麻豆| 精品国产123| 欧美一区二区三区喷汁尤物| 色综合天天狠狠| zzijzzij亚洲日本少妇熟睡| 国产精品自拍在线| 久久精品国产一区二区三 | 欧美精品国产精品| 在线视频观看一区| 91影院在线观看| 成人免费观看视频| 夫妻av一区二区| 高清不卡在线观看av| 激情五月激情综合网| 美女一区二区视频| 日韩av电影天堂| 丝袜诱惑制服诱惑色一区在线观看| 一区二区高清免费观看影视大全| 亚洲视频在线观看一区| 国产精品天美传媒沈樵| 国产喷白浆一区二区三区| ww亚洲ww在线观看国产| 欧美mv和日韩mv国产网站| 欧美成va人片在线观看| 日韩欧美你懂的| 精品粉嫩超白一线天av| 亚洲精品在线观| 久久久亚洲欧洲日产国码αv| 久久久精品免费观看| 久久综合九色综合久久久精品综合| 欧美变态口味重另类| 欧美精品一区二区久久久| 精品国产伦理网| 国产欧美综合在线观看第十页| 日本一区二区三区电影| 亚洲欧美综合色| 亚洲影视在线播放| 天天亚洲美女在线视频| 久久精品免费观看| 成人黄色a**站在线观看| 91视频观看免费| 欧日韩精品视频| 欧美一区二区三区在线视频 | 91精品国产综合久久婷婷香蕉| 欧美一区二区三区人| 欧美变态口味重另类| 中文字幕欧美日韩一区| 亚洲码国产岛国毛片在线| 亚洲成av人**亚洲成av**| 日韩电影在线观看一区| 国产高清在线精品| 91精彩视频在线观看| 69精品人人人人| 2023国产精品| 亚洲精品乱码久久久久久日本蜜臀| 亚洲妇熟xx妇色黄| 极品少妇xxxx精品少妇| 9i在线看片成人免费| 欧美日韩在线观看一区二区| 日韩一级二级三级| 亚洲国产岛国毛片在线| 亚洲午夜羞羞片| 国产原创一区二区三区| 日本韩国一区二区| 精品国产一区二区三区忘忧草 | 久久精品综合网| 亚洲狠狠丁香婷婷综合久久久| 欧美aaaaa成人免费观看视频| 丰满少妇久久久久久久| 69av一区二区三区| 国产精品免费视频观看| 日韩精品欧美精品| 波多野洁衣一区| 欧美r级在线观看| 亚洲一区二区三区不卡国产欧美| 国内成+人亚洲+欧美+综合在线| 91在线观看视频| 精品99999| 亚洲福利一二三区| 成人福利视频在线看| 欧美一区二区精美| 亚洲精品国产a久久久久久 | 久久66热re国产| 欧美午夜理伦三级在线观看| 欧美国产精品一区| 免费高清在线一区| 欧美亚洲日本国产| 国产精品美女久久久久aⅴ| 蜜桃视频一区二区三区在线观看| 91色|porny| 国产日韩欧美精品一区| 日本欧洲一区二区| 欧美色老头old∨ideo| 国产精品乱码一区二区三区软件| 久久精品国产**网站演员| 精品污污网站免费看| 亚洲欧洲中文日韩久久av乱码| 国产乱妇无码大片在线观看| 91精品国产手机| 亚洲一二三区视频在线观看| 99在线热播精品免费| 日本一区二区免费在线| 韩国三级中文字幕hd久久精品| 欧美一区欧美二区| 五月激情丁香一区二区三区| 在线视频一区二区免费| 国产精品毛片高清在线完整版| 国产一区二区三区四| 精品国内二区三区| 久久成人免费电影| 日韩精品一区二区三区老鸭窝| 香蕉久久一区二区不卡无毒影院| 在线观看亚洲成人| 一区二区三区日韩在线观看| 91老师国产黑色丝袜在线| 亚洲欧洲日韩在线| 99久久婷婷国产精品综合| 中文字幕国产一区| 成人av免费观看| 国产精品久久国产精麻豆99网站| 成人涩涩免费视频| 国产精品私房写真福利视频| 国产成人午夜视频| 国产精品久久久久桃色tv| 成人国产精品免费观看| 亚洲三级免费电影| 欧美亚洲图片小说| 日韩精品电影一区亚洲| 欧美变态口味重另类| 国产盗摄视频一区二区三区| 中文字幕精品—区二区四季| 99久久久久免费精品国产 | 一区二区三区四区国产精品| 色综合色狠狠天天综合色| 亚洲一区二区视频在线观看| 在线播放国产精品二区一二区四区| 天堂蜜桃一区二区三区| 欧美一区二区二区| 九九九久久久精品| 国产欧美精品一区二区三区四区 | 精品999在线播放| 成人午夜电影网站| 亚洲一区二区三区美女| 日韩亚洲欧美在线观看| 国产成人精品免费在线| 国产精品久久久久久久裸模| 日本高清无吗v一区| 日韩制服丝袜av| 欧美极品美女视频| 欧洲色大大久久| 韩国女主播成人在线| 国产精品久久久久精k8| 欧美日本高清视频在线观看| 九九国产精品视频| 亚洲欧洲无码一区二区三区| 欧美日韩一二区| 国产精品中文欧美| 伊人婷婷欧美激情| 日韩久久免费av| 色综合天天性综合| 美女视频网站黄色亚洲| 中文字幕国产精品一区二区| 欧美日韩精品一区二区三区四区| 激情国产一区二区| 亚洲精品中文在线影院| 欧美不卡一区二区三区四区| 色综合中文字幕| 国内精品伊人久久久久av一坑| 国产精品护士白丝一区av| 欧美剧情电影在线观看完整版免费励志电影| 韩国三级电影一区二区| 亚洲国产精品久久久久婷婷884 | 国产一区二区福利视频| 综合久久久久久| 欧美精品一区视频| 欧美视频中文字幕| www.成人网.com| 久久99在线观看| 亚洲一区中文日韩| 国产欧美日韩另类视频免费观看 | 欧美tickling挠脚心丨vk| 91麻豆6部合集magnet| 久久99精品久久久久久国产越南| 伊人一区二区三区| 国产精品国产三级国产普通话三级| 日韩欧美中文字幕一区|