##// END OF EJS Templates
revlog: memset whole record instead of dealing with padding...
pacien -
r49612:654baf1f default
parent child Browse files
Show More
@@ -158,7 +158,7 b' static const long entry_v2_offset_node_i'
158 static const long entry_v2_offset_sidedata_offset = 64;
158 static const long entry_v2_offset_sidedata_offset = 64;
159 static const long entry_v2_offset_sidedata_comp_len = 72;
159 static const long entry_v2_offset_sidedata_comp_len = 72;
160 static const long entry_v2_offset_all_comp_mode = 76;
160 static const long entry_v2_offset_all_comp_mode = 76;
161 static const long entry_v2_offset_padding_start = 77;
161 /* next free offset: 77 */
162
162
163 static const char comp_mode_inline = 2;
163 static const char comp_mode_inline = 2;
164 static const char rank_unknown = -1;
164 static const char rank_unknown = -1;
@@ -603,6 +603,8 b' static PyObject *index_append(indexObjec'
603 rev = self->length + self->new_length;
603 rev = self->length + self->new_length;
604 data = self->added + self->entry_size * self->new_length++;
604 data = self->added + self->entry_size * self->new_length++;
605
605
606 memset(data, 0, self->entry_size);
607
606 if (self->format_version == format_v1) {
608 if (self->format_version == format_v1) {
607 putbe32(offset_flags >> 32, data + entry_v1_offset_high);
609 putbe32(offset_flags >> 32, data + entry_v1_offset_high);
608 putbe32(offset_flags & 0xffffffffU,
610 putbe32(offset_flags & 0xffffffffU,
@@ -615,9 +617,6 b' static PyObject *index_append(indexObjec'
615 putbe32(parent_2, data + entry_v1_offset_parent_2);
617 putbe32(parent_2, data + entry_v1_offset_parent_2);
616 memcpy(data + entry_v1_offset_node_id, c_node_id,
618 memcpy(data + entry_v1_offset_node_id, c_node_id,
617 c_node_id_len);
619 c_node_id_len);
618 /* Padding since SHA-1 is only 20 bytes for now */
619 memset(data + entry_v1_offset_node_id + c_node_id_len, 0,
620 entry_v1_offset_node_id - c_node_id_len);
621 } else if (self->format_version == format_v2) {
620 } else if (self->format_version == format_v2) {
622 putbe32(offset_flags >> 32, data + entry_v2_offset_high);
621 putbe32(offset_flags >> 32, data + entry_v2_offset_high);
623 putbe32(offset_flags & 0xffffffffU,
622 putbe32(offset_flags & 0xffffffffU,
@@ -630,9 +629,6 b' static PyObject *index_append(indexObjec'
630 putbe32(parent_2, data + entry_v2_offset_parent_2);
629 putbe32(parent_2, data + entry_v2_offset_parent_2);
631 memcpy(data + entry_v2_offset_node_id, c_node_id,
630 memcpy(data + entry_v2_offset_node_id, c_node_id,
632 c_node_id_len);
631 c_node_id_len);
633 /* Padding since SHA-1 is only 20 bytes for now */
634 memset(data + entry_v2_offset_node_id + c_node_id_len, 0,
635 entry_v2_offset_node_id - c_node_id_len);
636 putbe64(sidedata_offset,
632 putbe64(sidedata_offset,
637 data + entry_v2_offset_sidedata_offset);
633 data + entry_v2_offset_sidedata_offset);
638 putbe32(sidedata_comp_len,
634 putbe32(sidedata_comp_len,
@@ -640,9 +636,6 b' static PyObject *index_append(indexObjec'
640 comp_field = data_comp_mode & 3;
636 comp_field = data_comp_mode & 3;
641 comp_field = comp_field | (sidedata_comp_mode & 3) << 2;
637 comp_field = comp_field | (sidedata_comp_mode & 3) << 2;
642 data[entry_v2_offset_all_comp_mode] = comp_field;
638 data[entry_v2_offset_all_comp_mode] = comp_field;
643 /* Padding for 96 bytes alignment */
644 memset(data + entry_v2_offset_padding_start, 0,
645 self->entry_size - entry_v2_offset_padding_start);
646 } else {
639 } else {
647 raise_revlog_error();
640 raise_revlog_error();
648 return NULL;
641 return NULL;
General Comments 0
You need to be logged in to leave comments. Login now