~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/page/page0zip.c

  • Committer: Brian Aker
  • Date: 2010-12-25 00:28:49 UTC
  • mto: This revision was merged to the branch mainline in revision 2031.
  • Revision ID: brian@tangent.org-20101225002849-g73mg6ihulajis0o
First pass in refactoring of the name of my_decimal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
651
651
 
652
652
/**********************************************************************//**
653
653
Allocate memory for zlib. */
654
 
extern "C" void* page_zip_malloc(void* opaque, uInt items, uInt size);
655
 
 
656
 
extern "C" void* page_zip_malloc
657
 
(
 
654
static
 
655
void*
 
656
page_zip_malloc(
658
657
/*============*/
659
658
        void*   opaque, /*!< in/out: memory heap */
660
659
        uInt    items,  /*!< in: number of items to allocate */
661
660
        uInt    size)   /*!< in: size of an item in bytes */
662
661
{
663
 
        return(mem_heap_alloc(static_cast<mem_block_info_t *>(opaque), items * size));
 
662
        return(mem_heap_alloc(opaque, items * size));
664
663
}
665
664
 
666
665
/**********************************************************************//**
667
666
Deallocate memory for zlib. */
668
 
extern "C" void page_zip_free(void *opaque, void *address);
669
 
 
670
 
extern "C" void page_zip_free(void *, void *)
671
 
{ }
 
667
static
 
668
void
 
669
page_zip_free(
 
670
/*==========*/
 
671
        void*   opaque __attribute__((unused)), /*!< in: memory heap */
 
672
        void*   address __attribute__((unused)))/*!< in: object to free */
 
673
{
 
674
}
672
675
 
673
676
/**********************************************************************//**
674
677
Configure the zlib allocator to use the given memory heap. */
679
682
        void*           stream,         /*!< in/out: zlib stream */
680
683
        mem_heap_t*     heap)           /*!< in: memory heap to use */
681
684
{
682
 
        z_stream*       strm = static_cast<z_stream *>(stream);
 
685
        z_stream*       strm = stream;
683
686
 
684
687
        strm->zalloc = page_zip_malloc;
685
688
        strm->zfree = page_zip_free;
1226
1229
                               + UNIV_PAGE_SIZE * 4
1227
1230
                               + (512 << MAX_MEM_LEVEL));
1228
1231
 
1229
 
        recs = static_cast<const unsigned char **>(mem_heap_zalloc(heap, n_dense * sizeof *recs));
1230
 
 
1231
 
        fields = static_cast<byte *>(mem_heap_alloc(heap, (n_fields + 1) * 2));
1232
 
 
1233
 
        buf = static_cast<byte *>(mem_heap_alloc(heap, page_zip_get_size(page_zip) - PAGE_DATA));
 
1232
        recs = mem_heap_zalloc(heap, n_dense * sizeof *recs);
 
1233
 
 
1234
        fields = mem_heap_alloc(heap, (n_fields + 1) * 2);
 
1235
 
 
1236
        buf = mem_heap_alloc(heap, page_zip_get_size(page_zip) - PAGE_DATA);
1234
1237
        buf_end = buf + page_zip_get_size(page_zip) - PAGE_DATA;
1235
1238
 
1236
1239
        /* Compress the data payload. */
2851
2854
        }
2852
2855
 
2853
2856
        heap = mem_heap_create(n_dense * (3 * sizeof *recs) + UNIV_PAGE_SIZE);
2854
 
        recs = static_cast<byte **>(mem_heap_alloc(heap, n_dense * (2 * sizeof *recs)));
 
2857
        recs = mem_heap_alloc(heap, n_dense * (2 * sizeof *recs));
2855
2858
 
2856
2859
        if (all) {
2857
2860
                /* Copy the page header. */
2954
2957
                /* Pre-allocate the offsets for rec_get_offsets_reverse(). */
2955
2958
                ulint   n = 1 + 1/* node ptr */ + REC_OFFS_HEADER_SIZE
2956
2959
                        + dict_index_get_n_fields(index);
2957
 
                offsets = static_cast<unsigned long *>(mem_heap_alloc(heap, n * sizeof(ulint)));
 
2960
                offsets = mem_heap_alloc(heap, n * sizeof(ulint));
2958
2961
                *offsets = n;
2959
2962
        }
2960
2963
 
4656
4659
        /* Exclude FIL_PAGE_SPACE_OR_CHKSUM, FIL_PAGE_LSN,
4657
4660
        and FIL_PAGE_FILE_FLUSH_LSN from the checksum. */
4658
4661
 
4659
 
        const Bytef*    s       = static_cast<const Bytef *>(data);
 
4662
        const Bytef*    s       = data;
4660
4663
        uLong           adler;
4661
4664
 
4662
4665
        ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);