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

Commit38b259f

Browse files
committed
Style fixes, revert unnecessary ereport() and FALSE
1 parentbdcadfe commit38b259f

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

‎src/shared_ispell.c

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ _PG_fini(void)
166166
staticvoid
167167
ispell_shmem_startup()
168168
{
169-
boolfound=FALSE;
169+
boolfound=false;
170170
char*segment;
171171

172172
if (prev_shmem_startup_hook)
@@ -177,27 +177,19 @@ ispell_shmem_startup()
177177
*/
178178
LWLockAcquire(AddinShmemInitLock,LW_EXCLUSIVE);
179179

180-
segment=ShmemInitStruct(SEGMENT_NAME,
181-
max_ispell_mem_size(),
182-
&found);
180+
segment=ShmemInitStruct(SEGMENT_NAME,max_ispell_mem_size(),&found);
183181
segment_info= (SegmentInfo*)segment;
184182

185183
/* Was the shared memory segment already initialized? */
186184
if (!found)
187185
{
188-
if (segment==NULL) {
189-
ereport(ERROR,
190-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
191-
errmsg("Cannot acquire %d kB of shared memory",
192-
max_ispell_mem_size_kb)));
193-
}
194186
memset(segment,0,max_ispell_mem_size());
195187

196-
#ifPG_VERSION_NUM >=90600
188+
#ifPG_VERSION_NUM >=90600
197189
segment_info->lock=&(GetNamedLWLockTranche("shared_ispell"))->lock;
198-
#else
190+
#else
199191
segment_info->lock=LWLockAssign();
200-
#endif
192+
#endif
201193
segment_info->firstfree=segment+MAXALIGN(sizeof(SegmentInfo));
202194
segment_info->available=max_ispell_mem_size()
203195
- (int)(segment_info->firstfree-segment);
@@ -293,9 +285,9 @@ clean_dict_affix(IspellDict *dict)
293285
staticvoid
294286
init_shared_dict(DictInfo*info,char*dictFile,char*affFile,char*stopFile)
295287
{
296-
intsize;
288+
intsize;
297289
SharedIspellDict*shdict=NULL;
298-
SharedStopList*shstop=NULL;
290+
SharedStopList*shstop=NULL;
299291

300292
/* DICTIONARY + AFFIXES */
301293

@@ -315,7 +307,7 @@ init_shared_dict(DictInfo *info, char *dictFile, char *affFile, char *stopFile)
315307
/* load the dictionary (word list) if not yet defined */
316308
if (shdict==NULL)
317309
{
318-
IspellDict*dict;
310+
IspellDict*dict;
319311

320312
dict= (IspellDict*)palloc0(sizeof(IspellDict));
321313

@@ -337,11 +329,13 @@ init_shared_dict(DictInfo *info, char *dictFile, char *affFile, char *stopFile)
337329
*/
338330
if (info->dict.useFlagAliases)
339331
{
340-
inti;
332+
inti;
333+
341334
dict->useFlagAliases= true;
342335
dict->lenAffixData=info->dict.lenAffixData;
343336
dict->nAffixData=info->dict.nAffixData;
344337
dict->AffixData= (char**)palloc0(dict->nAffixData*sizeof(char*));
338+
345339
for (i=0;i<dict->nAffixData;i++)
346340
{
347341
dict->AffixData[i]=palloc0(strlen(info->dict.AffixData[i])+1);
@@ -721,8 +715,8 @@ shstrcpy(char *str)
721715
staticSPNode*
722716
copySPNode(SPNode*node)
723717
{
724-
inti;
725-
SPNode*copy=NULL;
718+
inti;
719+
SPNode*copy=NULL;
726720

727721
if (node==NULL)
728722
returnNULL;
@@ -739,8 +733,8 @@ copySPNode(SPNode *node)
739733
staticint
740734
sizeSPNode(SPNode*node)
741735
{
742-
inti;
743-
intsize=0;
736+
inti;
737+
intsize=0;
744738

745739
if (node==NULL)
746740
return0;
@@ -852,9 +846,9 @@ sizeIspellDict(IspellDict *dict, char *dictFile, char *affixFile)
852846
Datum
853847
dispell_list_dicts(PG_FUNCTION_ARGS)
854848
{
855-
FuncCallContext*funcctx;
856-
TupleDesctupdesc;
857-
SharedIspellDict*dict;
849+
FuncCallContext*funcctx;
850+
TupleDesctupdesc;
851+
SharedIspellDict*dict;
858852

859853
/* init on the first call */
860854
if (SRF_IS_FIRSTCALL())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp