NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
search_state.h File Reference

Holds state of a search. More...

#include <stdbool.h>
#include <stdint.h>
+ Include dependency graph for search_state.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SearchState
 Holds state of a search. More...
 

Typedefs

typedef uint8_t SearchFlags
 

Enumerations

enum  SearchFlag { SEARCH_NONE = 0 , SEARCH_PROMPT = 1U << 0 , SEARCH_OPPOSITE = 1U << 1 }
 Flags for a specific search. More...
 

Functions

struct SearchStatesearch_state_new (void)
 Create a new SearchState.
 
void search_state_free (struct SearchState **search)
 Free a SearchState.
 

Detailed Description

Holds state of a search.

Authors
  • Richard Russon
  • Dennis Schön

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 search_state.h.

Typedef Documentation

◆ SearchFlags

typedef uint8_t SearchFlags

Definition at line 52 of file search_state.h.

Enumeration Type Documentation

◆ SearchFlag

enum SearchFlag

Flags for a specific search.

Enumerator
SEARCH_NONE 

No flags are set.

SEARCH_PROMPT 

Ask for search input.

SEARCH_OPPOSITE 

Search in the opposite direction.

Definition at line 46 of file search_state.h.

47{
48 SEARCH_NONE = 0,
49 SEARCH_PROMPT = 1U << 0,
50 SEARCH_OPPOSITE = 1U << 1,
51};
@ SEARCH_NONE
No flags are set.
@ SEARCH_PROMPT
Ask for search input.
@ SEARCH_OPPOSITE
Search in the opposite direction.

Function Documentation

◆ search_state_new()

struct SearchState * search_state_new ( void )

Create a new SearchState.

Return values
ptrNew SearchState

Definition at line 39 of file search_state.c.

40{
41 struct SearchState *s = MUTT_MEM_CALLOC(1, struct SearchState);
42 s->string = buf_pool_get();
44 return s;
45}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
Holds state of a search.
struct Buffer * string
search string
struct Buffer * string_expn
expanded search string
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ search_state_free()

void search_state_free ( struct SearchState ** ptr)

Free a SearchState.

Parameters
ptrSearchState to free

Definition at line 51 of file search_state.c.

52{
53 if (!ptr || !*ptr)
54 return;
55
56 struct SearchState *s = *ptr;
60
61 FREE(ptr);
62}
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
Definition compile.c:836
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
struct PatternList * pattern
compiled search pattern
+ Here is the call graph for this function:
+ Here is the caller graph for this function: