~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/table.cc

Removing deprecated functions from code and replacing them with C99 equivalents:
- replacing bcmp() calls with memcmp() calls
- replacing bfill() with memset()
- replacing bmove() and bcopy() with memcpy() or memmove()

The function memcpy_fixed() was apparantly introduced to fix a problem in gcc on
Alpha, but since it is not used consistently, it is likely not necessary any more.
It was replaced with memcpy().

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
                       &path_buff, path_length + 1,
181
181
                       NULL))
182
182
  {
183
 
    bzero((char*) share, sizeof(*share));
 
183
    memset((char*) share, 0, sizeof(*share));
184
184
 
185
185
    share->set_table_cache_key(key_buff, key, key_length);
186
186
 
245
245
                          const char *path)
246
246
{
247
247
 
248
 
  bzero((char*) share, sizeof(*share));
 
248
  memset((char*) share, 0, sizeof(*share));
249
249
  init_sql_alloc(&share->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
250
250
  share->table_category=         TABLE_CATEGORY_TEMPORARY;
251
251
  share->tmp_table=              INTERNAL_TMP_TABLE;
583
583
  if (!(keyinfo = (KEY*) alloc_root(&share->mem_root,
584
584
                                    n_length + uint2korr(disk_buff+4))))
585
585
    goto err;                                   /* purecov: inspected */
586
 
  bzero((char*) keyinfo,n_length);
 
586
  memset((char*) keyinfo, 0, n_length);
587
587
  share->key_info= keyinfo;
588
588
  key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys);
589
589
  strpos=disk_buff+6;
610
610
    for (j=keyinfo->key_parts ; j-- ; key_part++)
611
611
    {
612
612
      *rec_per_key++=0;
613
 
      key_part->fieldnr=        (uint16) (uint2korr(strpos) & FIELD_NR_MASK);
 
613
      key_part->fieldnr=        (uint16_t) (uint2korr(strpos) & FIELD_NR_MASK);
614
614
      key_part->offset= (uint) uint2korr(strpos+2)-1;
615
615
      key_part->key_type=       (uint) uint2korr(strpos+5);
616
616
      // key_part->field=       (Field*) 0;     // Will be fixed later
960
960
      }
961
961
      else
962
962
        charset= share->table_charset;
963
 
      bzero((char*) &comment, sizeof(comment));
 
963
      memset((char*) &comment, 0, sizeof(comment));
964
964
    }
965
965
 
966
966
    if (interval_nr && charset->mbminlen > 1)
999
999
 
1000
1000
    *field_ptr= reg_field=
1001
1001
      make_field(share, record+recpos,
1002
 
                 (uint32) field_length,
 
1002
                 (uint32_t) field_length,
1003
1003
                 null_pos, null_bit_pos,
1004
1004
                 pack_flag,
1005
1005
                 field_type,
1076
1076
      {
1077
1077
        Field *field;
1078
1078
        if (new_field_pack_flag <= 1)
1079
 
          key_part->fieldnr= (uint16) find_field(share->field,
 
1079
          key_part->fieldnr= (uint16_t) find_field(share->field,
1080
1080
                                                 share->default_values,
1081
1081
                                                 (uint) key_part->offset,
1082
1082
                                                 (uint) key_part->length);
1157
1157
              error.
1158
1158
            */
1159
1159
            keyinfo->key_length-= (key_part->length - field->key_length());
1160
 
            key_part->store_length-= (uint16)(key_part->length -
 
1160
            key_part->store_length-= (uint16_t)(key_part->length -
1161
1161
                                              field->key_length());
1162
 
            key_part->length= (uint16)field->key_length();
 
1162
            key_part->length= (uint16_t)field->key_length();
1163
1163
            sql_print_error("Found wrong key definition in %s; "
1164
1164
                            "Please do \"ALTER TABLE '%s' FORCE \" to fix it!",
1165
1165
                            share->table_name.str,
1221
1221
  {
1222
1222
    /* Old file format with default as not null */
1223
1223
    uint null_length= (share->null_fields+7)/8;
1224
 
    bfill(share->default_values + (null_flags - (uchar*) record),
 
1224
    memset(share->default_values + (null_flags - (uchar*) record), 
1225
1225
          null_length, 255);
1226
1226
  }
1227
1227
 
1339
1339
  assert(thd->lex->is_lex_started);
1340
1340
 
1341
1341
  error= 1;
1342
 
  bzero((char*) outparam, sizeof(*outparam));
 
1342
  memset((char*) outparam, 0, sizeof(*outparam));
1343
1343
  outparam->in_use= thd;
1344
1344
  outparam->s= share;
1345
1345
  outparam->db_stat= db_stat;
1547
1547
  }
1548
1548
 
1549
1549
#if defined(HAVE_purify) 
1550
 
  bzero((char*) bitmaps, bitmap_size*3);
 
1550
  memset((char*) bitmaps, 0, bitmap_size*3);
1551
1551
#endif
1552
1552
 
1553
1553
  outparam->no_replicate= outparam->file &&
1563
1563
  delete outparam->file;
1564
1564
  outparam->file= 0;                            // For easier error checking
1565
1565
  outparam->db_stat=0;
1566
 
  free_root(&outparam->mem_root, MYF(0));       // Safe to call on bzero'd root
 
1566
  free_root(&outparam->mem_root, MYF(0));       // Safe to call on zeroed root
1567
1567
  my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR));
1568
1568
  return (error);
1569
1569
}
1656
1656
      my_free((uchar*) buf,MYF(0));
1657
1657
  }
1658
1658
  else if (!names)
1659
 
    bzero((char*) save_names,sizeof(save_names));
 
1659
    memset((char*) save_names, 0, sizeof(save_names));
1660
1660
  else
1661
1661
  {
1662
1662
    char *str;
1724
1724
        return(0);
1725
1725
      endpos-=bufflength; bufflength=IO_SIZE;
1726
1726
    }
1727
 
    bzero(buff,IO_SIZE);                        /* Null new block */
 
1727
    memset(buff, 0, IO_SIZE);                   /* Null new block */
1728
1728
    VOID(my_seek(file,(ulong) maxlength,MY_SEEK_SET,MYF(0)));
1729
1729
    if (my_write(file,buff,bufflength,MYF(MY_NABP+MY_WME)))
1730
1730
        return(0L);
2041
2041
  {
2042
2042
    uint key_length, tmp_key_length;
2043
2043
    uint tmp;
2044
 
    bzero((char*) fileinfo,64);
 
2044
    memset((char*) fileinfo, 0, 64);
2045
2045
    /* header */
2046
2046
    fileinfo[0]=(uchar) 254;
2047
2047
    fileinfo[1]= 1;
2110
2110
      61 for default_part_db_type
2111
2111
    */
2112
2112
    int2store(fileinfo+62, create_info->key_block_size);
2113
 
    bzero(fill,IO_SIZE);
 
2113
    memset(fill, 0, IO_SIZE);
2114
2114
    for (; length > IO_SIZE ; length-= IO_SIZE)
2115
2115
    {
2116
2116
      if (my_write(file,fill, IO_SIZE, MYF(MY_WME | MY_NABP)))
3180
3180
    bitmap_clear_all(&table->def_read_set);
3181
3181
    bitmap_clear_all(&table->def_write_set);
3182
3182
  */
3183
 
  bzero((char*) def_read_set.bitmap, s->column_bitmap_size*2);
 
3183
  memset((char*) def_read_set.bitmap, 0, s->column_bitmap_size*2);
3184
3184
  column_bitmaps_set(&def_read_set, &def_write_set);
3185
3185
}
3186
3186