Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc155f65

Browse files
committed
intarray: return empty zero-dimensional array for an empty array
Previously a one-dimensional empty array was returned, but its textrepresentation matched a zero-dimensional array, and there is no way todump/reload a one-dimensional empty array.BACKWARD INCOMPATIBILITYPer report from elein
1 parentb810473 commitc155f65

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎contrib/intarray/_int_tool.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ resize_intArrayType(ArrayType *a, int num)
246246
intnbytes=ARR_DATA_OFFSET(a)+sizeof(int)*num;
247247
inti;
248248

249+
/* if no elements, return a zero-dimensional array */
250+
if (num==0)
251+
{
252+
ARR_NDIM(a)=0;
253+
returna;
254+
}
255+
249256
if (num==ARRNELEMS(a))
250257
returna;
251258

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp