403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.68.164.158
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/include/gdcache.h
#ifdef __cplusplus
extern "C" {
#endif

	/*
	 * gdcache.h
	 *
	 * Caches of pointers to user structs in which the least-recently-used
	 * element is replaced in the event of a cache miss after the cache has
	 * reached a given size.
	 *
	 * John Ellson  ([email protected])  Oct 31, 1997
	 *
	 * Test this with:
	 *		 gcc -o gdcache -g -Wall -DTEST -DNEED_CACHE gdcache.c -lgd
   *		 or
	 *		 gcc -o gdcache -g -Wall -DTEST -DNEED_CACHE gdcache.c libgd.a
	 *
	 * The cache is implemented by a singly-linked list of elements
	 * each containing a pointer to a user struct that is being managed by
	 * the cache.
	 *
	 * The head structure has a pointer to the most-recently-used
	 * element, and elements are moved to this position in the list each
	 * time they are used.  The head also contains pointers to three
	 * user defined functions:
	 *		- a function to test if a cached userdata matches some keydata
	 *		- a function to provide a new userdata struct to the cache
	 *          if there has been a cache miss.
	 *		- a function to release a userdata struct when it is
	 *          no longer being managed by the cache
	 *
	 * In the event of a cache miss the cache is allowed to grow up to
	 * a specified maximum size.  After the maximum size is reached then
	 * the least-recently-used element is discarded to make room for the
	 * new.  The most-recently-returned value is always left at the
	 * beginning of the list after retrieval.
	 *
	 * In the current implementation the cache is traversed by a linear
	 * search from most-recent to least-recent.  This linear search
	 * probably limits the usefulness of this implementation to cache
	 * sizes of a few tens of elements.
	 */

	/*********************************************************/
	/* header                                                */
	/*********************************************************/

#include <stdlib.h>
#ifndef NULL
#	define NULL (void *)0
#endif

	/* user defined function templates */
	typedef int (*gdCacheTestFn_t)(void *userdata, void *keydata);
	typedef void *(*gdCacheFetchFn_t)(char **error, void *keydata);
	typedef void (*gdCacheReleaseFn_t)(void *userdata);

	/* element structure */
	typedef struct gdCache_element_s gdCache_element_t;
	struct gdCache_element_s {
		gdCache_element_t *next;
		void *userdata;
	};

	/* head structure */
	typedef struct gdCache_head_s gdCache_head_t;
	struct gdCache_head_s {
		gdCache_element_t *mru;
		int size;
		char *error;
		gdCacheTestFn_t gdCacheTest;
		gdCacheFetchFn_t gdCacheFetch;
		gdCacheReleaseFn_t gdCacheRelease;
	};

	/* function templates */
	gdCache_head_t *gdCacheCreate(int size,
	                              gdCacheTestFn_t gdCacheTest,
	                              gdCacheFetchFn_t gdCacheFetch,
	                              gdCacheReleaseFn_t gdCacheRelease
	                             );

	void gdCacheDelete(gdCache_head_t *head);

	void *gdCacheGet(gdCache_head_t *head, void *keydata);

#ifdef __cplusplus
}
#endif

Youez - 2016 - github.com/yon3zu
LinuXploit