Compare two info structures */
| 568 | |
| 569 | /* Compare two info structures */ |
| 570 | static Py_ssize_t |
| 571 | _buffer_info_cmp(_buffer_info_t *a, _buffer_info_t *b) |
| 572 | { |
| 573 | Py_ssize_t c; |
| 574 | int k; |
| 575 | |
| 576 | if (a->format != NULL && b->format != NULL) { |
| 577 | c = strcmp(a->format, b->format); |
| 578 | if (c != 0) return c; |
| 579 | } |
| 580 | c = a->ndim - b->ndim; |
| 581 | if (c != 0) return c; |
| 582 | |
| 583 | for (k = 0; k < a->ndim; ++k) { |
| 584 | c = a->shape[k] - b->shape[k]; |
| 585 | if (c != 0) return c; |
| 586 | c = a->strides[k] - b->strides[k]; |
| 587 | if (c != 0) return c; |
| 588 | } |
| 589 | |
| 590 | return 0; |
| 591 | } |
| 592 | |
| 593 | |
| 594 | /* |