Skip to content

Conversation

@kio-watanabe
Copy link
Contributor

I added EXCEPTION-FILE and EXCEPTION-LOCATION in CobolIntrinsic.java.
And, New test cases were added to functions.at.

Comment on lines 1943 to 1944
data = String.valueOf(' ');
currField.memcpy(data.getBytes(), 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下記のように変更してはどうでしょうか。

currField.getDataStorage().setByte(0, ' ');

このように変更した場合、変数dataが未使用になるので、変数dataの宣言も削除してください

|| (CobolRuntimeException.getExceptionCode() & 0x0500) != 0x0500) {
field.setSize(2);
makeFieldEntry(field);
currField.memcpy("00", 2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memcpyの内部で"00"からbyte[]への変換が発生します。
文字列からbyte[]への変換は性能への影響が大きい場合があるので、改善してください。
例えば、

//メンバ変数の宣言
private static final byte[] byteArray00 = "00".getBytes():

//データのコピー
currField.memcpy(byteArray00, 2);

または、

CobolDataStorage storage = currField.getDataStorage();
storage.setByte(0, '0');
storage.setByte(1, '0');

のように変更するのが良いと考えます。

@kio-watanabe
Copy link
Contributor Author

レビューの内容に従ってコードを修正しました。

@yutaro-sakamoto yutaro-sakamoto merged commit 921c770 into opensourcecobol:develop Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants