NeoMutt  2025-09-05-2-g4bf191
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
helpers.c File Reference

Shared code. More...

#include "config.h"
#include <stddef.h>
#include "mutt/lib.h"
#include "helpers.h"
#include "mutt_thread.h"
#include "render.h"
+ Include dependency graph for helpers.c:

Go to the source code of this file.

Functions

const struct ExpandoRenderCallbackfind_get_number (const struct ExpandoRenderCallback *erc, int did, int uid)
 Find a get_number() callback function.
 
const struct ExpandoRenderCallbackfind_get_string (const struct ExpandoRenderCallback *erc, int did, int uid)
 Find a get_string() callback function.
 
void buf_lower_special (struct Buffer *buf)
 Convert to lowercase, excluding special characters.
 

Detailed Description

Shared code.

Authors
  • Tóth János
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file helpers.c.

Function Documentation

◆ find_get_number()

const struct ExpandoRenderCallback * find_get_number ( const struct ExpandoRenderCallback erc,
int  did,
int  uid 
)

Find a get_number() callback function.

Parameters
ercRender callbacks to search
didDomain ID to match
uidUnique ID to match
Return values
ptrMatching Render data

Definition at line 44 of file helpers.c.

46{
47 if (!erc)
48 return NULL;
49
50 for (; erc->did != -1; erc++)
51 {
52 if ((erc->did == did) && (erc->uid == uid) && erc->get_number)
53 {
54 return erc;
55 }
56 }
57
58 return NULL;
59}
int uid
Unique ID, e.g. ExpandoDataAlias.
Definition: render.h:78
int did
Domain ID, ExpandoDomain.
Definition: render.h:77
get_number_t get_number
Definition: render.h:81
+ Here is the caller graph for this function:

◆ find_get_string()

const struct ExpandoRenderCallback * find_get_string ( const struct ExpandoRenderCallback erc,
int  did,
int  uid 
)

Find a get_string() callback function.

Parameters
ercRender callbacks to search
didDomain ID to match
uidUnique ID to match
Return values
ptrMatching Render data

Definition at line 68 of file helpers.c.

70{
71 if (!erc)
72 return NULL;
73
74 for (; erc->did != -1; erc++)
75 {
76 if ((erc->did == did) && (erc->uid == uid) && erc->get_string)
77 {
78 return erc;
79 }
80 }
81
82 return NULL;
83}
get_string_t get_string
Definition: render.h:80
+ Here is the caller graph for this function:

◆ buf_lower_special()

void buf_lower_special ( struct Buffer buf)

Convert to lowercase, excluding special characters.

Parameters
bufString to lowercase

The string is transformed in place.

Definition at line 91 of file helpers.c.

92{
93 if (!buf || !buf->data)
94 return;
95
96 char *p = buf->data;
97
98 while (*p)
99 {
100 if (*p == MUTT_SPECIAL_INDEX)
101 {
102 p += 2;
103 continue;
104 }
105 else if (*p < MUTT_TREE_MAX)
106 {
107 p++;
108 continue;
109 }
110
111 *p = mutt_tolower(*p);
112 p++;
113 }
114}
int mutt_tolower(int arg)
Wrapper for tolower(3)
Definition: ctype.c:125
@ MUTT_TREE_MAX
Definition: mutt_thread.h:70
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:72
char * data
Pointer to data.
Definition: buffer.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function: