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

Commit1afd1a5

Browse files
committed
Code style fixes
1 parent6431b33 commit1afd1a5

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

‎src/shared_ispell.c

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int sizeStopList(StopList *list, char *stopFile);
9494
staticSize
9595
max_ispell_mem_size()
9696
{
97-
return (Size)max_ispell_mem_size_kb*1024L;
97+
return (Size)max_ispell_mem_size_kb*1024L;
9898
}
9999

100100
/*
@@ -134,11 +134,11 @@ _PG_init(void)
134134
*/
135135
RequestAddinShmemSpace(max_ispell_mem_size());
136136

137-
#ifPG_VERSION_NUM >=90600
137+
#ifPG_VERSION_NUM >=90600
138138
RequestNamedLWLockTranche("shared_ispell",1);
139-
#else
139+
#else
140140
RequestAddinLWLocks(1);
141-
#endif
141+
#endif
142142

143143
/* Install hooks. */
144144
prev_shmem_startup_hook=shmem_startup_hook;
@@ -166,8 +166,8 @@ _PG_fini(void)
166166
staticvoid
167167
ispell_shmem_startup()
168168
{
169-
boolfound= false;
170-
char*segment;
169+
boolfound= false;
170+
char*segment;
171171

172172
if (prev_shmem_startup_hook)
173173
prev_shmem_startup_hook();
@@ -191,8 +191,8 @@ ispell_shmem_startup()
191191
segment_info->lock=LWLockAssign();
192192
#endif
193193
segment_info->firstfree=segment+MAXALIGN(sizeof(SegmentInfo));
194-
segment_info->available=max_ispell_mem_size()
195-
-(int)(segment_info->firstfree-segment);
194+
segment_info->available=max_ispell_mem_size()-
195+
(int)(segment_info->firstfree-segment);
196196

197197
segment_info->lastReset=GetCurrentTimestamp();
198198
}
@@ -311,7 +311,7 @@ init_shared_dict(DictInfo *info, MemoryContext infoCntx,
311311
/* load the dictionary (word list) if not yet defined */
312312
if (shdict==NULL)
313313
{
314-
IspellDict*dict;
314+
IspellDict*dict;
315315

316316
dict= (IspellDict*)palloc0(sizeof(IspellDict));
317317

@@ -422,14 +422,6 @@ init_shared_dict(DictInfo *info, MemoryContext infoCntx,
422422
info->infoCntx=infoCntx;
423423
}
424424

425-
Datumdispell_init(PG_FUNCTION_ARGS);
426-
Datumdispell_lexize(PG_FUNCTION_ARGS);
427-
Datumdispell_reset(PG_FUNCTION_ARGS);
428-
Datumdispell_mem_available(PG_FUNCTION_ARGS);
429-
Datumdispell_mem_used(PG_FUNCTION_ARGS);
430-
Datumdispell_list_dicts(PG_FUNCTION_ARGS);
431-
Datumdispell_list_stoplists(PG_FUNCTION_ARGS);
432-
433425
PG_FUNCTION_INFO_V1(dispell_init);
434426
PG_FUNCTION_INFO_V1(dispell_lexize);
435427
PG_FUNCTION_INFO_V1(dispell_reset);
@@ -453,7 +445,8 @@ dispell_reset(PG_FUNCTION_ARGS)
453445
segment_info->shstop=NULL;
454446
segment_info->lastReset=GetCurrentTimestamp();
455447
segment_info->firstfree= ((char*)segment_info)+MAXALIGN(sizeof(SegmentInfo));
456-
segment_info->available=max_ispell_mem_size()- (int)(segment_info->firstfree- (char*)segment_info);
448+
segment_info->available=max_ispell_mem_size()-
449+
(int) (segment_info->firstfree- (char*)segment_info);
457450

458451
memset(segment_info->firstfree,0,segment_info->available);
459452

@@ -479,12 +472,14 @@ dispell_mem_available(PG_FUNCTION_ARGS)
479472
}
480473

481474
/*
482-
* Returns amount of 'occupied space' in the shared segment (used by current dictionaries).
475+
* Returns amount of 'occupied space' in the shared segment (used by current
476+
* dictionaries).
483477
*/
484478
Datum
485479
dispell_mem_used(PG_FUNCTION_ARGS)
486480
{
487-
intresult=0;
481+
intresult=0;
482+
488483
LWLockAcquire(segment_info->lock,LW_SHARED);
489484

490485
result=max_ispell_mem_size()-segment_info->available;
@@ -679,7 +674,8 @@ dispell_lexize(PG_FUNCTION_ARGS)
679674
staticchar*
680675
shalloc(intbytes)
681676
{
682-
char*result;
677+
char*result;
678+
683679
bytes=MAXALIGN(bytes);
684680

685681
/* This shouldn't really happen, as the init_shared_dict checks the size
@@ -706,8 +702,10 @@ shalloc(int bytes)
706702
staticchar*
707703
shstrcpy(char*str)
708704
{
709-
char*tmp=shalloc(strlen(str)+1);
705+
char*tmp=shalloc(strlen(str)+1);
706+
710707
memcpy(tmp,str,strlen(str)+1);
708+
711709
returntmp;
712710
}
713711

@@ -801,8 +799,7 @@ sizeStopList(StopList *list, char *stopFile)
801799
staticSharedIspellDict*
802800
copyIspellDict(IspellDict*dict,char*dictFile,char*affixFile,intsize,intwords)
803801
{
804-
inti;
805-
802+
inti;
806803
SharedIspellDict*copy= (SharedIspellDict*)shalloc(sizeof(SharedIspellDict));
807804

808805
copy->dictFile=shalloc(strlen(dictFile)+1);
@@ -834,8 +831,8 @@ copyIspellDict(IspellDict *dict, char *dictFile, char *affixFile, int size, int
834831
staticint
835832
sizeIspellDict(IspellDict*dict,char*dictFile,char*affixFile)
836833
{
837-
inti;
838-
intsize=MAXALIGN(sizeof(SharedIspellDict));
834+
inti;
835+
intsize=MAXALIGN(sizeof(SharedIspellDict));
839836

840837
size+=MAXALIGN(strlen(dictFile)+1);
841838
size+=MAXALIGN(strlen(affixFile)+1);

‎src/shared_ispell.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ typedef struct SharedStopList
4242
typedefstructSegmentInfo
4343
{
4444
LWLockIdlock;
45-
char*firstfree;/* first free address (always maxaligned) */
46-
size_tavailable;/* free space remaining at firstfree */
47-
TimestamplastReset;/* last reset of the dictionary */
45+
char*firstfree;/* first free address (always maxaligned) */
46+
size_tavailable;/* free space remaining at firstfree */
47+
TimestamplastReset;/* last reset of the dictionary */
4848

4949
/* the shared segment (info and data) */
5050
SharedIspellDict*shdict;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp