Docunext


Malloc

November 20th, 2009

In GD over FastCGI, malloc is used with the cdb functions.

        /* Word color */
        if (cdb_find(&cdb, color, klen) > 0) { /* if search successful */
            vpos = cdb_datapos(&cdb); /* position of data in a file */
            vlen = cdb_datalen(&cdb); /* length of data */
            val = malloc(vlen); /* allocate memory */
            cdb_read(&cdb, val, vlen, vpos); /* read the value into buffer */
            temp = strtok (val, delimiters);
            red = atoi(temp);
            temp = strtok (NULL, delimiters);
            green = atoi(temp);
            temp = strtok (NULL, delimiters);
            blue = atoi(temp);
            free(val);
        }

Malloc refers to memory allocation.

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022