@@ -233,16 +233,16 @@ static VALUE rb_git_diff_patch_lines(int argc, VALUE *argv, VALUE self)
233
233
*
234
234
* The following options can be passed in the +options+ Hash:
235
235
*
236
- * :include_context ::
237
- * Boolean value specifying that context lines should be included when
236
+ * :exclude_context ::
237
+ * Boolean value specifying that context lines should be excluded when
238
238
* counting the number of bytes in the patch.
239
239
*
240
- * :include_hunk_headers ::
241
- * Boolean value specifying that hunk headers should be included when
240
+ * :exclude_hunk_headers ::
241
+ * Boolean value specifying that hunk headers should be excluded when
242
242
* counting the number of bytes in the patch.
243
243
*
244
- * :include_file_headers ::
245
- * Boolean value specifying that file headers should be included when
244
+ * :exclude_file_headers ::
245
+ * Boolean value specifying that file headers should be excluded when
246
246
* counting the number of bytes in the patch.
247
247
*
248
248
* Returns the number of bytes in the patch, depending on which options are
@@ -253,27 +253,29 @@ static VALUE rb_git_diff_patch_bytesize(int argc, VALUE *argv, VALUE self)
253
253
git_patch * patch ;
254
254
size_t bytesize ;
255
255
VALUE rb_options ;
256
- int options [ 3 ] ;
256
+ int include_context , include_hunk_headers , include_file_headers ;
257
257
Data_Get_Struct (self , git_patch , patch );
258
258
259
- memset (options , 0 , sizeof (options ));
259
+ include_context = 1 ;
260
+ include_hunk_headers = 1 ;
261
+ include_file_headers = 1 ;
260
262
261
263
rb_scan_args (argc , argv , "0:" , & rb_options );
262
264
if (!NIL_P (rb_options )) {
263
- if (RTEST ( rb_hash_aref (rb_options , CSTR2SYM ("include_context" ))) ) {
264
- options [ 0 ] = 1 ;
265
+ if (rb_hash_aref (rb_options , CSTR2SYM ("include_context" )) == Qfalse ) {
266
+ include_context = 0 ;
265
267
}
266
268
267
- if (RTEST ( rb_hash_aref (rb_options , CSTR2SYM ("include_hunk_headers" ))) ) {
268
- options [ 1 ] = 1 ;
269
+ if (rb_hash_aref (rb_options , CSTR2SYM ("include_hunk_headers" )) == Qfalse ) {
270
+ include_hunk_headers = 0 ;
269
271
}
270
272
271
- if (RTEST ( rb_hash_aref (rb_options , CSTR2SYM ("include_file_headers" ))) ) {
272
- options [ 2 ] = 1 ;
273
+ if (rb_hash_aref (rb_options , CSTR2SYM ("include_file_headers" )) == Qfalse ) {
274
+ include_file_headers = 0 ;
273
275
}
274
276
}
275
277
276
- bytesize = git_patch_size (patch , options [ 0 ], options [ 1 ], options [ 2 ] );
278
+ bytesize = git_patch_size (patch , include_context , include_hunk_headers , include_file_headers );
277
279
278
280
return INT2FIX (bytesize );
279
281
}
0 commit comments