Skip to content

Commit dd84b51

Browse files
Use lower_case names for global functions and data: util2.h
1 parent 0557fde commit dd84b51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+192
-192
lines changed

inews/inews.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
116116
cp = get_val("NNTPSERVER");
117117
if (!cp)
118118
{
119-
cp = filexp(SERVER_NAME);
119+
cp = file_exp(SERVER_NAME);
120120
if (FILE_REF(cp))
121121
{
122122
cp = nntp_server_name(cp);
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
133133
g_nntplink.port_number = std::atoi(cp+1);
134134
}
135135
line_end = "\r\n";
136-
g_nntp_auth_file = filexp(NNTP_AUTH_FILE);
136+
g_nntp_auth_file = file_exp(NNTP_AUTH_FILE);
137137
if ((cp = std::getenv("NNTP_FORCE_AUTH")) != nullptr
138138
&& (*cp == 'y' || *cp == 'Y'))
139139
{
@@ -399,7 +399,7 @@ void append_signature()
399399
return;
400400
}
401401

402-
fp = std::fopen(filexp(SIGNATURE_FILE), "r");
402+
fp = std::fopen(file_exp(SIGNATURE_FILE), "r");
403403
if (fp == nullptr)
404404
{
405405
return;

libtrn/art.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ DoArticleResult do_article()
357357
if ((s = std::strchr(bufptr,'\n')) != nullptr
358358
&& s-bufptr < sizeof g_art_line)
359359
{
360-
safecpy(g_art_line,bufptr,s-bufptr+1);
360+
safe_copy(g_art_line,bufptr,s-bufptr+1);
361361
}
362362
else
363363
{
364-
safecpy(g_art_line,bufptr,sizeof g_art_line);
364+
safe_copy(g_art_line,bufptr,sizeof g_art_line);
365365
}
366366
s = extract_name(g_art_line + 6);
367367
if (s != nullptr)

libtrn/artio.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ char *read_art_buf(bool view_inline)
534534
for (t++; *++t == ' ' || *t == '\t'; spaces++)
535535
{
536536
}
537-
safecpy(t-spaces,t,extra_chars);
537+
safe_copy(t-spaces,t,extra_chars);
538538
extra_chars -= spaces;
539539
t -= spaces + 1;
540540
}

libtrn/artsrch.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ArtSearchResult art_search(char *pat_buf, int pat_buf_siz, bool get_cmd)
9393
srchhdr = g_art_srch_hdr;
9494
doread = g_art_do_read;
9595
}
96-
char *s = cpytill(g_buf,pat_buf+1,cmdchr);/* ok to cpy g_buf+1 to g_buf */
96+
char *s = copy_till(g_buf,pat_buf+1,cmdchr);/* ok to cpy g_buf+1 to g_buf */
9797
pattern = g_buf;
9898
if (*pattern)
9999
{
@@ -111,7 +111,7 @@ ArtSearchResult art_search(char *pat_buf, int pat_buf_siz, bool get_cmd)
111111

112112
case 'H': /* scan a specific header */
113113
howmuch = ARTSCOPE_ONE_HDR;
114-
s = cpytill(g_msg, s+1, ':');
114+
s = copy_till(g_msg, s+1, ':');
115115
srchhdr = get_header_num(g_msg);
116116
goto loop_break;
117117

@@ -364,7 +364,7 @@ ArtSearchResult art_search(char *pat_buf, int pat_buf_siz, bool get_cmd)
364364
*s++ = g_scope_str[howmuch];
365365
if (howmuch == ARTSCOPE_ONE_HDR)
366366
{
367-
safecpy(s,g_htype[srchhdr].name,LBUFLEN-(s-saltbuf));
367+
safe_copy(s,g_htype[srchhdr].name,LBUFLEN-(s-saltbuf));
368368
s += g_htype[srchhdr].length;
369369
if (s - saltbuf > LBUFLEN-2)
370370
{
@@ -377,7 +377,7 @@ ArtSearchResult art_search(char *pat_buf, int pat_buf_siz, bool get_cmd)
377377
{
378378
cmdlst = save_str("j");
379379
}
380-
safecpy(s,cmdlst,LBUFLEN-(s-saltbuf));
380+
safe_copy(s,cmdlst,LBUFLEN-(s-saltbuf));
381381
kill_file_append(saltbuf, saltaway == 2? KF_GLOBAL : KF_LOCAL);
382382
}
383383
if (get_cmd)

libtrn/backpage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static long s_oldoffset{-1}; /* offset to block currently in window */
1818

1919
void back_page_init()
2020
{
21-
const char *varyname = filexp(VARYNAME);
21+
const char *varyname = file_exp(VARYNAME);
2222
close(creat(varyname,0600));
2323
s_varyfd = open(varyname,2);
2424
remove(varyname);

libtrn/bits.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,14 @@ static int chase_xref(ArticleNum artnum, int markread)
755755
termdown(1);
756756
}
757757
# endif
758-
curxref = cpytill(tmpbuf,xref_buf,' ') + 1;
758+
curxref = copy_till(tmpbuf,xref_buf,' ') + 1;
759759
# ifdef VALIDATE_XREF_SITE
760760
if (valid_xref_site(artnum,tmpbuf))
761761
# endif
762762
{
763763
while (*curxref) /* for each newsgroup */
764764
{
765-
curxref = cpytill(tmpbuf,curxref,' ');
765+
curxref = copy_till(tmpbuf,curxref,' ');
766766
xartnum = std::strchr(tmpbuf,':');
767767
if (!xartnum)
768768
{
@@ -839,7 +839,7 @@ static bool valid_xref_site(ART_NUM artnum, char *site)
839839
if (s != nullptr)
840840
{
841841
*s = '\0';
842-
inews_site = savestr(sitebuf);
842+
inews_site = save_str(sitebuf);
843843
}
844844
#else /* ANCIENT_NEWS */
845845
/* Grab the site from the Posting-Version line */
@@ -852,12 +852,12 @@ static bool valid_xref_site(ART_NUM artnum, char *site)
852852
{
853853
*t = '\0';
854854
}
855-
inews_site = savestr(s+7);
855+
inews_site = save_str(s+7);
856856
}
857857
#endif /* ANCIENT_NEWS */
858858
else
859859
{
860-
inews_site = savestr("");
860+
inews_site = save_str("");
861861
}
862862
std::free(sitebuf);
863863

libtrn/cache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ void set_subj_line(Article *ap, char *subj, int size)
541541
}
542542
if (subj_start != newsubj + 4)
543543
{
544-
safecpy(newsubj + 4, subj_start, size);
544+
safe_copy(newsubj + 4, subj_start, size);
545545
if ((size -= subj_start - newsubj - 4) < 0)
546546
{
547547
size = 0;

libtrn/charsubst.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ int str_char_subst(char *outb, const char *inb, int limit, char_int subst)
207207
{
208208
len = std::strlen(inb);
209209
}
210-
safecpy(outb, inb, limit);
210+
safe_copy(outb, inb, limit);
211211
return len;
212212
}
213213

libtrn/datasrc.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void data_source_init()
116116

117117
g_data_source_list = new_list(0,0,sizeof(DataSource),20,LF_ZERO_MEM,nullptr);
118118

119-
g_nntp_auth_file = filexp(NNTP_AUTH_FILE);
119+
g_nntp_auth_file = file_exp(NNTP_AUTH_FILE);
120120

121121
char *machine = get_val("NNTPSERVER");
122122
if (machine && std::strcmp(machine,"local") != 0)
@@ -141,7 +141,7 @@ void data_source_init()
141141

142142
if (!machine)
143143
{
144-
machine = filexp(SERVER_NAME);
144+
machine = file_exp(SERVER_NAME);
145145
if (FILE_REF(machine))
146146
{
147147
machine = nntp_server_name(machine);
@@ -195,7 +195,7 @@ char *read_data_sources(const char *filename)
195195
char* filebuf = nullptr;
196196
char** vals = ini_values(s_datasrc_ini);
197197

198-
int fd = open(filexp(filename), 0);
198+
int fd = open(file_exp(filename), 0);
199199
if (fd >= 0)
200200
{
201201
stat_t datasrc_stat{};
@@ -284,7 +284,7 @@ static DataSource *new_datasrc(const char *name, char **vals)
284284
}
285285
else
286286
{
287-
dp->news_id = save_str(filexp(vals[DI_ACTIVE_FILE]));
287+
dp->news_id = save_str(file_exp(vals[DI_ACTIVE_FILE]));
288288
}
289289

290290
dp->spool_dir = file_or_none(vals[DI_SPOOL_DIR]);
@@ -302,7 +302,7 @@ static DataSource *new_datasrc(const char *name, char **vals)
302302
/* FYI, we know extra_name to be nullptr in this case. */
303303
if (vals[DI_ACTIVE_FILE])
304304
{
305-
dp->extra_name = save_str(filexp(vals[DI_ACTIVE_FILE]));
305+
dp->extra_name = save_str(file_exp(vals[DI_ACTIVE_FILE]));
306306
stat_t extra_stat{};
307307
if (stat(dp->extra_name,&extra_stat) >= 0)
308308
{
@@ -412,7 +412,7 @@ static char *dir_or_none(DataSource *dp, const char *dir, DataSourceFlags flag)
412412
}
413413

414414
dp->flags |= flag;
415-
dir = filexp(dir);
415+
dir = file_exp(dir);
416416
if (!std::strcmp(dir,dp->spool_dir))
417417
{
418418
return dp->spool_dir;
@@ -426,7 +426,7 @@ static char *file_or_none(char *fn)
426426
{
427427
return nullptr;
428428
}
429-
return save_str(filexp(fn));
429+
return save_str(file_exp(fn));
430430
}
431431

432432
bool open_data_source(DataSource *dp)

libtrn/head.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ HeaderLineType get_header_num(char *s)
202202
{
203203
std::free(g_htype[CUSTOM_LINE].name);
204204
}
205-
g_htype[CUSTOM_LINE].name = savestr(g_msg);
205+
g_htype[CUSTOM_LINE].name = save_str(g_msg);
206206
g_htype[CUSTOM_LINE].length = end - s;
207207
g_htype[CUSTOM_LINE].flags = g_htype[i].flags;
208208
g_htype[CUSTOM_LINE].min_pos = -1;
@@ -283,7 +283,7 @@ void end_header_line()
283283
else
284284
{
285285
char* s = safe_malloc(size);
286-
safecpy(s,g_head_buf+start,size);
286+
safe_copy(s,g_head_buf+start,size);
287287
set_cached_line(s_parsed_artp,g_in_header,s);
288288
}
289289
}
@@ -503,13 +503,13 @@ char *fetch_lines(ArticleNum art_num, HeaderLineType which_line)
503503
s = fetch_cache(art_num,which_line, FILL_CACHE);
504504
if (s)
505505
{
506-
return savestr(s);
506+
return save_str(s);
507507
}
508508
}
509509
ArticlePosition firstpos = g_htype[which_line].min_pos;
510510
if (firstpos < 0)
511511
{
512-
return savestr("");
512+
return save_str("");
513513
}
514514

515515
firstpos += g_htype[which_line].length + 1;
@@ -529,7 +529,7 @@ char *fetch_lines(ArticleNum art_num, HeaderLineType which_line)
529529
}
530530
#endif
531531
s = safe_malloc((MemorySize)size);
532-
safecpy(s,t,size);
532+
safe_copy(s,t,size);
533533
return s;
534534
}
535535

@@ -574,7 +574,7 @@ char *mp_fetch_lines(ArticleNum art_num, HeaderLineType which_line, MemoryPool p
574574
}
575575
#endif
576576
s = mp_malloc(size,pool);
577-
safecpy(s,t,size);
577+
safe_copy(s,t,size);
578578
return s;
579579
}
580580

@@ -594,7 +594,7 @@ static int nntp_xhdr(HeaderLineType which_line, ArticleNum artnum, ArticleNum la
594594

595595
// ART_NUM artnum article to get line from */
596596
// int which_line type of line desired */
597-
// bool copy do you want it savestr()ed? */
597+
// bool copy do you want it save_str()ed? */
598598
char *prefetch_lines(ArticleNum art_num, HeaderLineType which_line, bool copy)
599599
{
600600
char* s;
@@ -614,7 +614,7 @@ char *prefetch_lines(ArticleNum art_num, HeaderLineType which_line, bool copy)
614614
{
615615
if (copy)
616616
{
617-
s = savestr(s);
617+
s = save_str(s);
618618
}
619619
return s;
620620
}
@@ -695,7 +695,7 @@ char *prefetch_lines(ArticleNum art_num, HeaderLineType which_line, bool copy)
695695
}
696696
else if (cached)
697697
{
698-
set_cached_line(ap, which_line, savestr(t));
698+
set_cached_line(ap, which_line, save_str(t));
699699
}
700700
if (num == art_num)
701701
{
@@ -746,7 +746,7 @@ char *prefetch_lines(ArticleNum art_num, HeaderLineType which_line, bool copy)
746746
{
747747
if (copy)
748748
{
749-
s = savestr(s);
749+
s = save_str(s);
750750
}
751751
return s;
752752
}
@@ -769,6 +769,6 @@ char *prefetch_lines(ArticleNum art_num, HeaderLineType which_line, bool copy)
769769
s = g_cmd_buf; /* really scraping for space here */
770770
size = std::min(size, static_cast<int>(sizeof g_cmd_buf));
771771
}
772-
safecpy(s,t,size);
772+
safe_copy(s,t,size);
773773
return s;
774774
}

0 commit comments

Comments
 (0)