mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Add some consts as recommended by make cppcheck.
This commit is contained in:
@@ -30,7 +30,7 @@ static hash_table DedupeTable;
|
||||
|
||||
static unsigned int DedupeHashFunc(void *x)
|
||||
{
|
||||
DedupeEntry *e = (DedupeEntry *) x;
|
||||
DedupeEntry const *e = (DedupeEntry const *) x;
|
||||
unsigned int hashval = (unsigned int) e->trigger_date;
|
||||
if (e->trigger_time != NO_TIME) {
|
||||
hashval += (unsigned int) e->trigger_time;
|
||||
@@ -41,8 +41,8 @@ static unsigned int DedupeHashFunc(void *x)
|
||||
|
||||
static int CompareDedupes(void *x, void *y)
|
||||
{
|
||||
DedupeEntry *a = (DedupeEntry *) x;
|
||||
DedupeEntry *b = (DedupeEntry *) y;
|
||||
DedupeEntry const *a = (DedupeEntry const *) x;
|
||||
DedupeEntry const *b = (DedupeEntry const *) y;
|
||||
if (a->trigger_date != b->trigger_date) return a->trigger_date - b->trigger_date;
|
||||
if (a->trigger_time != b->trigger_time) return a->trigger_time - b->trigger_time;
|
||||
return strcmp(a->body, b->body);
|
||||
@@ -122,7 +122,7 @@ InsertDedupeEntry(int trigger_date, int trigger_time, char const *body)
|
||||
int
|
||||
ShouldDedupe(int trigger_date, int trigger_time, char const *body)
|
||||
{
|
||||
DedupeEntry *e = FindDedupeEntry(trigger_date, trigger_time, body);
|
||||
DedupeEntry const *e = FindDedupeEntry(trigger_date, trigger_time, body);
|
||||
|
||||
if (e) {
|
||||
return 1;
|
||||
|
||||
@@ -116,14 +116,14 @@ static int IncludeCmd(char const *);
|
||||
|
||||
static unsigned int FnHashFunc(void *x)
|
||||
{
|
||||
FilenameHashEntry *e = (FilenameHashEntry *) x;
|
||||
FilenameHashEntry const *e = (FilenameHashEntry const *) x;
|
||||
return HashVal_preservecase(e->fname);
|
||||
}
|
||||
|
||||
static int FnCompareFunc(void *a, void *b)
|
||||
{
|
||||
FilenameHashEntry *e1 = (FilenameHashEntry *) a;
|
||||
FilenameHashEntry *e2 = (FilenameHashEntry *) b;
|
||||
FilenameHashEntry const *e1 = (FilenameHashEntry const *) a;
|
||||
FilenameHashEntry const *e2 = (FilenameHashEntry const *) b;
|
||||
return strcmp(e1->fname, e2->fname);
|
||||
}
|
||||
|
||||
@@ -1151,7 +1151,7 @@ int IncludeFile(char const *fname)
|
||||
int GetAccessDate(char const *file)
|
||||
{
|
||||
struct stat statbuf;
|
||||
struct tm *t1;
|
||||
struct tm const *t1;
|
||||
|
||||
if (stat(file, &statbuf)) return -1;
|
||||
t1 = localtime(&(statbuf.st_atime));
|
||||
|
||||
@@ -141,7 +141,7 @@ hash_table_free(hash_table *t)
|
||||
* \return The number of items in the hash table
|
||||
*/
|
||||
size_t
|
||||
hash_table_num_entries(hash_table *t)
|
||||
hash_table_num_entries(hash_table const *t)
|
||||
{
|
||||
return t->num_entries;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ hash_table_num_entries(hash_table *t)
|
||||
* \return The number of buckets in the hash table
|
||||
*/
|
||||
size_t
|
||||
hash_table_num_buckets(hash_table *t)
|
||||
hash_table_num_buckets(hash_table const *t)
|
||||
{
|
||||
if (t->bucket_choice_index >= NUM_BUCKET_CHOICES) {
|
||||
return 0;
|
||||
|
||||
@@ -59,8 +59,8 @@ int hash_table_init(hash_table *t,
|
||||
unsigned int (*hashfunc)(void *x),
|
||||
int (*compare)(void *a, void *b));
|
||||
void hash_table_free(hash_table *t);
|
||||
size_t hash_table_num_entries(hash_table *t);
|
||||
size_t hash_table_num_buckets(hash_table *t);
|
||||
size_t hash_table_num_entries(hash_table const *t);
|
||||
size_t hash_table_num_buckets(hash_table const *t);
|
||||
size_t hash_table_chain_len(hash_table *t, size_t i);
|
||||
int hash_table_insert(hash_table *t, void *item);
|
||||
void *hash_table_find(hash_table *t, void *candidate);
|
||||
|
||||
@@ -1063,7 +1063,7 @@ static void InitializeVar(char const *str)
|
||||
static void
|
||||
AddTrustedUser(char const *username)
|
||||
{
|
||||
struct passwd *pwent;
|
||||
struct passwd const *pwent;
|
||||
if (NumTrustedUsers >= MAX_TRUSTED_USERS) {
|
||||
fprintf(ErrFp, "Too many trusted users (%d max)\n",
|
||||
MAX_TRUSTED_USERS);
|
||||
|
||||
@@ -636,7 +636,7 @@ static time_t time_t_from_dse(int dse)
|
||||
|
||||
static int datetime_from_time_t(time_t t)
|
||||
{
|
||||
struct tm *local;
|
||||
struct tm const *local;
|
||||
int ans;
|
||||
|
||||
/* Round to nearest minute */
|
||||
|
||||
@@ -443,7 +443,7 @@ static int TokStrCmp(Token const *t, char const *s)
|
||||
}
|
||||
|
||||
static void
|
||||
print_token(Token *tok)
|
||||
print_token(Token const *tok)
|
||||
{
|
||||
if (tok->MinLen < (int) strlen(tok->name)) {
|
||||
printf("%.*s\n", tok->MinLen, tok->name);
|
||||
|
||||
@@ -274,15 +274,15 @@ DumpTranslationTable(FILE *fp, int json)
|
||||
static unsigned int
|
||||
HashXlateItem(void *x)
|
||||
{
|
||||
XlateItem *item = (XlateItem *) x;
|
||||
XlateItem const *item = (XlateItem const *) x;
|
||||
return HashVal_preservecase(item->orig);
|
||||
}
|
||||
|
||||
static int
|
||||
CompareXlateItems(void *a, void *b)
|
||||
{
|
||||
XlateItem *i = (XlateItem *) a;
|
||||
XlateItem *j = (XlateItem *) b;
|
||||
XlateItem const *i = (XlateItem const *) a;
|
||||
XlateItem const *j = (XlateItem const *) b;
|
||||
return strcmp(i->orig, j->orig);
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ InsertTranslation(char const *orig, char const *translated)
|
||||
char const *
|
||||
GetTranslatedString(char const *orig)
|
||||
{
|
||||
XlateItem *item = FindTranslation(orig);
|
||||
XlateItem const *item = FindTranslation(orig);
|
||||
if (!item) return NULL;
|
||||
return item->translated;
|
||||
}
|
||||
|
||||
@@ -38,14 +38,14 @@ static void RenameUserFunc(char const *oldname, char const *newname);
|
||||
|
||||
static unsigned int HashUserFunc(void *x)
|
||||
{
|
||||
UserFunc *f = (UserFunc *) x;
|
||||
UserFunc const *f = (UserFunc const *) x;
|
||||
return HashVal_preservecase(f->name);
|
||||
}
|
||||
|
||||
static int CompareUserFuncs(void *a, void *b)
|
||||
{
|
||||
UserFunc *f = (UserFunc *) a;
|
||||
UserFunc *g = (UserFunc *) b;
|
||||
UserFunc const *f = (UserFunc const *) a;
|
||||
UserFunc const *g = (UserFunc const *) b;
|
||||
return strcmp(f->name, g->name);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ print_callstack_aux(FILE *fp, cs *entry)
|
||||
{
|
||||
int i = 0;
|
||||
char const *in = tr("In");
|
||||
cs *prev = NULL;
|
||||
cs const *prev = NULL;
|
||||
while(entry) {
|
||||
if (prev) {
|
||||
in = tr("Called from");
|
||||
|
||||
@@ -40,7 +40,7 @@ static int SetSysVarHelper(SysVar *v, Value *value);
|
||||
|
||||
static unsigned int VarHashFunc(void *x)
|
||||
{
|
||||
Var *v = (Var *) x;
|
||||
Var const *v = (Var const *) x;
|
||||
return HashVal_ignorecase(v->name);
|
||||
}
|
||||
|
||||
@@ -1100,12 +1100,12 @@ static SysVar SysVarArr[] = {
|
||||
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
|
||||
static void DumpSysVar (char const *name, const SysVar *v);
|
||||
|
||||
static int SetTranslatableVariable(SysVar *v, Value *value)
|
||||
static int SetTranslatableVariable(SysVar const *v, Value const *value)
|
||||
{
|
||||
return InsertTranslation((char const *) v->value, value->v.str);
|
||||
}
|
||||
|
||||
static int GetTranslatableVariable(SysVar *v, Value *value)
|
||||
static int GetTranslatableVariable(SysVar const *v, Value *value)
|
||||
{
|
||||
char const *translated = tr((char const *) v->value);
|
||||
if (translated) {
|
||||
@@ -1256,7 +1256,7 @@ SysVar *FindSysVar(char const *name)
|
||||
void DumpSysVarByName(char const *name)
|
||||
{
|
||||
size_t i;
|
||||
SysVar *v;
|
||||
SysVar const *v;
|
||||
|
||||
if (!name || !*name) {
|
||||
for (i=0; i<NUMSYSVARS; i++) DumpSysVar(name, SysVarArr + i);
|
||||
|
||||
Reference in New Issue
Block a user