Changeset 1765 in MondoRescue for branches/2.2.5/mindi-busybox/libbb/crc32.c


Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/libbb/crc32.c

    r821 r1765  
    77 *
    88 * The following function creates a CRC32 table depending on whether
    9  * a big-endian (0x04c11db7) or little-endian (0xedb88320) CRC32 is 
     9 * a big-endian (0x04c11db7) or little-endian (0xedb88320) CRC32 is
    1010 * required. Admittedly, there are other CRC32 polynomials floating
    1111 * around, but Busybox doesn't use them.
     
    1515 */
    1616
    17 #include <stdio.h>
    18 #include <stdlib.h>
    1917#include "libbb.h"
    2018
    21 uint32_t *bb_crc32_filltable (int endian) {
    22    
    23     uint32_t *crc_table = xmalloc(256 * sizeof(uint32_t));
     19uint32_t *crc32_filltable(uint32_t *crc_table, int endian)
     20{
    2421    uint32_t polynomial = endian ? 0x04c11db7 : 0xedb88320;
    2522    uint32_t c;
    2623    int i, j;
    27    
     24
     25    if (!crc_table)
     26        crc_table = xmalloc(256 * sizeof(uint32_t));
     27
    2828    for (i = 0; i < 256; i++) {
    2929        c = endian ? (i << 24) : i;
Note: See TracChangeset for help on using the changeset viewer.