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

Commit5497daf

Browse files
Replace calls to pg_qsort() with the qsort() macro.
Calls to this function might give the impression that pg_qsort()is somehow different than qsort(), when in fact there is a qsort()macro in port.h that expands all in-tree uses to pg_qsort().Reviewed-by: Mats KindahlDiscussion:https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com
1 parentd57b7cc commit5497daf

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

‎contrib/pg_prewarm/autoprewarm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ apw_load_buffers(void)
346346
FreeFile(file);
347347

348348
/* Sort the blocks to be loaded. */
349-
pg_qsort(blkinfo,num_elements,sizeof(BlockInfoRecord),
350-
apw_compare_blockinfo);
349+
qsort(blkinfo,num_elements,sizeof(BlockInfoRecord),
350+
apw_compare_blockinfo);
351351

352352
/* Populate shared memory state. */
353353
apw_state->block_info_handle=dsm_segment_handle(seg);

‎src/backend/access/brin/brin_minmax_multi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ build_distances(FmgrInfo *distanceFn, Oid colloid,
13691369
* Sort the distances in descending order, so that the longest gaps are at
13701370
* the front.
13711371
*/
1372-
pg_qsort(distances,ndistances,sizeof(DistanceValue),compare_distances);
1372+
qsort(distances,ndistances,sizeof(DistanceValue),compare_distances);
13731373

13741374
returndistances;
13751375
}

‎src/backend/optimizer/plan/analyzejoins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,8 +2307,8 @@ remove_self_joins_recurse(PlannerInfo *root, List *joinlist, Relids toRemove)
23072307
j++;
23082308
}
23092309

2310-
pg_qsort(candidates,numRels,sizeof(SelfJoinCandidate),
2311-
self_join_candidates_cmp);
2310+
qsort(candidates,numRels,sizeof(SelfJoinCandidate),
2311+
self_join_candidates_cmp);
23122312

23132313
/*
23142314
* Iteratively form a group of relation indexes with the same oid and

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3915,7 +3915,7 @@ DropRelationsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
39153915

39163916
/* sort the list of rlocators if necessary */
39173917
if (use_bsearch)
3918-
pg_qsort(locators,n,sizeof(RelFileLocator),rlocator_comparator);
3918+
qsort(locators,n,sizeof(RelFileLocator),rlocator_comparator);
39193919

39203920
for (i=0;i<NBuffers;i++)
39213921
{
@@ -4269,7 +4269,7 @@ FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels)
42694269

42704270
/* sort the list of SMgrRelations if necessary */
42714271
if (use_bsearch)
4272-
pg_qsort(srels,nrels,sizeof(SMgrSortArray),rlocator_comparator);
4272+
qsort(srels,nrels,sizeof(SMgrSortArray),rlocator_comparator);
42734273

42744274
for (i=0;i<NBuffers;i++)
42754275
{

‎src/backend/utils/cache/syscache.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ InitCatalogCache(void)
146146
Assert(SysCacheSupportingRelOidSize <=lengthof(SysCacheSupportingRelOid));
147147

148148
/* Sort and de-dup OID arrays, so we can use binary search. */
149-
pg_qsort(SysCacheRelationOid,SysCacheRelationOidSize,
150-
sizeof(Oid),oid_compare);
149+
qsort(SysCacheRelationOid,SysCacheRelationOidSize,
150+
sizeof(Oid),oid_compare);
151151
SysCacheRelationOidSize=
152152
qunique(SysCacheRelationOid,SysCacheRelationOidSize,sizeof(Oid),
153153
oid_compare);
154154

155-
pg_qsort(SysCacheSupportingRelOid,SysCacheSupportingRelOidSize,
156-
sizeof(Oid),oid_compare);
155+
qsort(SysCacheSupportingRelOid,SysCacheSupportingRelOidSize,
156+
sizeof(Oid),oid_compare);
157157
SysCacheSupportingRelOidSize=
158158
qunique(SysCacheSupportingRelOid,SysCacheSupportingRelOidSize,
159159
sizeof(Oid),oid_compare);
@@ -668,7 +668,7 @@ RelationSupportsSysCache(Oid relid)
668668

669669

670670
/*
671-
* OID comparator forpg_qsort
671+
* OID comparator forqsort
672672
*/
673673
staticint
674674
oid_compare(constvoid*a,constvoid*b)

‎src/include/port.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ extern bool pg_get_user_name(uid_t user_id, char *buffer, size_t buflen);
438438
externboolpg_get_user_home_dir(uid_tuser_id,char*buffer,size_tbuflen);
439439
#endif
440440

441+
/*
442+
* Callers should use the qsort() macro defined below instead of calling
443+
* pg_qsort() directly.
444+
*/
441445
externvoidpg_qsort(void*base,size_tnel,size_telsize,
442446
int (*cmp) (constvoid*,constvoid*));
443447
externintpg_qsort_strcmp(constvoid*a,constvoid*b);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp