NeoMutt  2024-04-16-36-g75b6fb
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...
 

Macros

#define SEARCH_NO_FLAGS   0
 No flags are set.
 
#define SEARCH_PROMPT   (1 << 0)
 Ask for search input.
 
#define SEARCH_OPPOSITE   (1 << 1)
 Search in the opposite direction.
 

Typedefs

typedef uint8_t SearchFlags
 Flags for a specific search, e.g. SEARCH_PROMPT.
 

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.

Macro Definition Documentation

◆ SEARCH_NO_FLAGS

#define SEARCH_NO_FLAGS   0

No flags are set.

Definition at line 44 of file search_state.h.

◆ SEARCH_PROMPT

#define SEARCH_PROMPT   (1 << 0)

Ask for search input.

Definition at line 45 of file search_state.h.

◆ SEARCH_OPPOSITE

#define SEARCH_OPPOSITE   (1 << 1)

Search in the opposite direction.

Definition at line 46 of file search_state.h.

Typedef Documentation

◆ SearchFlags

typedef uint8_t SearchFlags

Flags for a specific search, e.g. SEARCH_PROMPT.

Definition at line 43 of file search_state.h.

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, sizeof(struct SearchState));
42 s->string = buf_pool_get();
44 return s;
45}
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
Holds state of a search.
Definition: search_state.h:36
struct Buffer * string
search string
Definition: search_state.h:38
struct Buffer * string_expn
expanded search string
Definition: search_state.h:39
+ 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:777
#define FREE(x)
Definition: memory.h:45
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
struct PatternList * pattern
compiled search pattern
Definition: search_state.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function: