/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* camel-uid-cache.c: UID caching code. */ /* * Authors: * Dan Winship * * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #include "config.h" #include "camel-uid-cache.h" #include #include #include #include #include static void free_uid (gpointer key, gpointer value, gpointer data); static void maybe_write_uid (gpointer key, gpointer value, gpointer data); /** * camel_uid_cache_new: * @filename: path to load the cache from * * Creates a new UID cache, initialized from @filename. If @filename * doesn't already exist, the UID cache will be empty. Otherwise, if * it does exist but can't be read, the function will return %NULL. * * Return value: a new UID cache, or %NULL **/ CamelUIDCache * camel_uid_cache_new (const char *filename) { CamelUIDCache *cache; struct stat st; char *buf, **uids; int fd, i; fd = open (filename, O_RDWR | O_CREAT, 0700); if (fd == -1) return NULL; if (fstat (fd, &st) != 0) { close (fd); return NULL; } buf = g_malloc (st.st_size + 1); if (read (fd, buf, st.st_size) == -1) { close (fd); g_free (buf); return NULL; } buf[st.st_size] = '\0'; cache = g_new (CamelUIDCache, 1); cache->fd = fd; cache->level = 1; cache->uids = g_hash_table_new (g_str_hash, g_str_equal); uids = g_strsplit (buf, "\n", 0); g_free (buf); for (i = 0; uids[i]; i++) { g_hash_table_insert (cache->uids, uids[i], GINT_TO_POINTER (cache->level)); } g_free (uids); return cache; } /** * camel_uid_cache_save: * @cache: a CamelUIDCache * * Attempts to save @cache back to disk. * * Return value: success or failure **/ gboolean camel_uid_cache_save (CamelUIDCache *cache) { if (lseek (cache->fd, 0, SEEK_SET) != 0) return FALSE; g_hash_table_foreach (cache->uids, maybe_write_uid, cache); return ftruncate (cache->fd, lseek (cache->fd, 0, SEEK_CUR)) == 0; } static void maybe_write_uid (gpointer key, gpointer value, gpointer data) { CamelUIDCache *cache = data; if (GPOINTER_TO_INT (value) == cache->level) { write (cache->fd, key, strlen (key)); write (cache->fd, "\n", 1); } } /** * camel_uid_cache_destroy: * @cache: a CamelUIDCache * * Destroys @cache and frees its data. **/ void camel_uid_cache_destroy (CamelUIDCache *cache) { g_hash_table_foreach (cache->uids, free_uid, NULL); g_hash_table_destroy (cache->uids); close (cache->fd); g_free (cache); } static void free_uid (gpointer key, gpointer value, gpointer data) { g_free (key); } /** * camel_uid_cache_get_new_uids: * @cache: a CamelUIDCache * @uids: an array of UIDs * * Returns an array of UIDs from @uids that are not in @cache, and * removes UIDs from @cache that aren't in @uids. * * Return value: an array of new UIDs, which must be freed with * camel_uid_cache_free_uids(). **/ GPtrArray * camel_uid_cache_get_new_uids (CamelUIDCache *cache, GPtrArray *uids) { GPtrArray *new_uids; char *uid; int i; new_uids = g_ptr_array_new (); cache->level++; for (i = 0; i < uids->len; i++) { uid = uids->pdata[i]; if (g_hash_table_lookup (cache->uids, uid)) g_hash_table_remove (cache->uids, uid); else g_ptr_array_add (new_uids, g_strdup (uid)); g_hash_table_insert (cache->uids, g_strdup (uid), GINT_TO_POINTER (cache->level)); } return new_uids; } /** * camel_uid_cache_free_uids: * @uids: an array returned from camel_uid_cache_get_new_uids() * * Frees the array of UIDs. **/ void camel_uid_cache_free_uids (GPtrArray *uids) { int i; for (i = 0; i < uids->len; i++) g_free (uids->pdata[i]); g_ptr_array_free (uids, TRUE); } gnome-3.36'>gnome-3.36 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* audio/hydrogen-devel: remove out of date portjbeich2018-01-181-1/+0
* audio/py-wavio: Python module for reading and writing WAV files using numpy a...yuri2018-01-161-0/+1
* Remove expired ports:rene2018-01-151-1/+0
* Remove expired port:rene2018-01-061-1/+0
* Add pc-mixer version 20171212 part of Lumina desktop version 1.4.1.araujo2017-12-221-0/+1
* New port: audio/faust: Functional programming language for realtime audio sig...yuri2017-12-211-0/+1
* Remove audio/last.fm. last.fm radio shutdown in March 2014.arved2017-12-191-1/+0
* New port: audio/GxSwitchlessWah-lv2: Analog wah emulation with switchless act...yuri2017-12-151-0/+1
* Remove expired ports:rene2017-12-141-1/+0
* New port: audio/fluidplug-lv2: SoundFonts as LV2 plugins via FluidSynthyuri2017-12-081-0/+1
* New port: audio/padthv1-lv2: Old-school polyphonic additive synthesizeryuri2017-12-081-0/+1
* New port: audio/screcord-lv2: LV2 capture pluginyuri2017-12-081-0/+1
* WMmp is a dockable musicpd (MPD) client applet for Window Maker.amdmi32017-12-061-1/+2
* New port: audio/hts_engine-APIpi2017-12-031-0/+1
* Convert Python ports to FLAVORS.mat2017-11-301-2/+0
* New port: audio/carla: Audio LV2 plugin host for Jack and PulseAudioyuri2017-11-301-0/+1
* Remove expired port:rene2017-11-301-1/+0
* New port: audio/sorcer-lv2: Wavetable LV2 plugin synth targeted at the electr...yuri2017-11-271-0/+1
* New port: audio/pms-devel, a from-scratch rewrite of audio/pms in Goriggs2017-11-181-0/+1
* New port: audio/eq10q-lv2: Parametric equalizer LV2 audio pluginyuri2017-11-151-0/+1
* Remove expired ports:rene2017-11-131-2/+0
* New port: audio/sc3-plugins: Extension plugins for the SuperCollider3 audio s...yuri2017-11-121-0/+1
* New port: audio/vmpk: Virtual MIDI Piano Keyboardyuri2017-11-121-0/+1
* New port: audio/abgate-lv2: Noise gate LV2 pluginyuri2017-11-121-0/+1
* New port: audio/yoshimitobik2017-11-111-0/+1
* New port: audio/amsynthtobik2017-11-111-0/+1
* Remove expired ports:rene2017-11-111-3/+0
* New port: audio/libmusicxml: Library and tools for the MusicXML formatyuri2017-11-111-0/+1
* New port: audio/gxplugins-lv2: Set of LV2 plugins from the guitarix projectyuri2017-11-111-0/+1
* New port: audio/polyphone: Graphical user interface for editing soundfont (sf...yuri2017-11-111-0/+1
* New port: audio/invada-studio-plugins-lv2: Set of LV2 audio effect plugins, p...yuri2017-11-111-0/+1
* New port: audio/drumstick: MIDI libraries for Qt5/C++yuri2017-11-111-0/+1
* New port: audio/triceratops-lv2: Polyphonic synthesizer LV2 pluginyuri2017-11-111-0/+1
* New port: audio/jalv-select: Little app to select lv2 plugs for run with jalvyuri2017-11-111-0/+1
* New port: audio/fomp-lv2: LV2 port of the MCP, VCO, FIL, and WAH plugins by F...yuri2017-11-111-0/+1
* New port: audio/eteroj-lv2: OSC injection/ejection from/to UDP/TCP/Serial for...yuri2017-11-081-0/+1
* New port: audio/luppp: Live looping music creation toolyuri2017-11-081-0/+1
* New port: audio/infamous-plugins-lv2: LV2 plugins for various sound effectsyuri2017-11-051-0/+1
* New port: audio/rtaudio: C++ classes that provide a common API for realtime a...yuri2017-11-041-0/+1
* New port: audio/foo-yc20: Faust implementation of a 1969-designed Yamaha comb...yuri2017-11-021-0/+1
* New port: audio/py-pysndfile: Cython wrapper class for soundfiles reading/wri...yuri2017-11-021-0/+1
* New port: audio/cavatobik2017-10-301-0/+1
* Remove audio/gstreamer-plugins-moodbar it is an abandonware with no publicbapt2017-10-131-1/+0
* Remove audio/festdoc:bapt2017-10-131-1/+0
* Remove ventrilo-serverbapt2017-10-041-1/+0
* Python bindings to the libopus, IETF low-delay audio codec.ultima2017-09-141-0/+1
* Remove expired ports:rene2017-09-031-1/+0
* Remove expired ports:rene2017-08-231-1/+0
* The C* Audio Plugin Suite, is a collection of highly refined LV2ultima2017-08-211-0/+1
* This is the LV2 porty of Tom's Audio Processing plugins.ultima2017-08-211-0/+1
* Synthpod is an LV2 host. It can be run as a standalone app and be used as aultima2017-08-211-0/+1
* Currently the following plugins are contained in this plugin bundle:ultima2017-08-211-0/+1
* Renamed to py-py-jack to match PyPI package nameultima2017-08-211-1/+1
* RtMidi is a set of C++ classes (RtMidiIn, RtMidiOut, and API specific classes)ultima2017-08-201-0/+1
* PyJack is a module written in C which exposes the Jack API to Python.ultima2017-08-201-0/+1
* A set of utilities to inspect other plugins:ultima2017-08-201-0/+1
* Steve Harris' LV2 version of Plugin Collection.ultima2017-08-201-0/+1
* lv2file is a simple program which you can use to apply effects to your audioultima2017-08-181-0/+1
* QMidiArp is an advanced MIDI arpeggiator, programmable step sequencer and LFO.ultima2017-08-181-0/+1
* Bandlimited oscillator plugins for LV2-aware audio applications.ultima2017-08-181-0/+1
* Jalv runs LV2 plugins and exposes their ports as Jack ports, essentiallyultima2017-08-181-0/+1
* LV2 Impulse response (convolution) plugin (for reverb and cabinet simulation).ultima2017-08-181-0/+1
* The Midi Matrix (Channel Filter) is a 3-in-1 filter plugin with a simple UIultima2017-08-181-0/+1
* Moony is a collection of LV2 plugins to easily add realtime programmableultima2017-08-181-0/+1
* The Synthesis ToolKit in C++ (STK) is a set of open source audio signalultima2017-08-181-0/+1
* MDA-LV2 is an LV2 port of the MDA plugins by Paul Kellett. It containsultima2017-08-161-0/+1
* Several LV2 plugin bundled together:ultima2017-08-151-0/+1
* This toolkit contains libraries that wrap the LV2 C API and extensions intoultima2017-08-141-0/+1
* New port: audio/py-gmusicproxy streams from Google Play Music to any playerriggs2017-08-121-0/+1
* A collection of professional lv2 audio plugins written by Robin Gareus.ultima2017-08-121-0/+1
* Linear (or Longitudinal) Timecode (LTC) is an encoding of SMPTE timecode dataultima2017-08-111-0/+1
* A C++ library implementing a real-time convolution matrix for up to 64 inputsultima2017-08-111-0/+1
* New port: audio/py-aubio - Python bindings for audio/aubiojhale2017-08-071-0/+1
* DrumGizmo is an open source, multichannel, multilayered, cross-platform drumamdmi32017-07-281-0/+1
* Update GStreamer1 ports to 1.12.2.kwm2017-07-221-1/+4
* Add new port audio/py-soundscrapecpm2017-06-051-0/+1
* New port: audio/gstreamer-plugins-sndiotobik2017-05-311-0/+1
* Hook audio/mpdscribble to the buildantoine2017-05-171-0/+1
* Resurrect, overhaul, and maintain audio/aylet. Project page is available. Theehaupt2017-05-081-0/+1
* Remove audio/ufmcontrol-i18n, this port was broken for more than six months.rene2017-05-071-1/+0
* hsaudiotag is a pure Python library that lets you read metadata (bitrate,miwi2017-05-061-0/+1
* 2017-04-30 devel/stormlib-ghost++: Unfetchable for more than six months (goog...ler2017-04-301-5/+0
* Add goattracker 2.73, a crossplatform music editor for creating Commodoreehaupt2017-04-301-0/+1
* - Rename audio/schism for better namingehaupt2017-04-131-1/+1
* Add protracker 2.3.d, amiga ProTracker clone.ehaupt2017-04-121-0/+1
* remove another gnome2 remnantbapt2017-04-021-1/+0
* Remove remnant from gnome 2 which is not depend on anymorebapt2017-04-021-1/+0
* New port: audio/supercollidertobik2017-03-211-0/+1
* - Resurrect `audio/rezound' as the days of gcc/libstdc++ mess are gonedanfe2017-03-041-0/+1
* This is a spectrogram plugin for DeaDBeeF audio player.danfe2017-03-021-0/+1
* New port: audio/sonic-visualisertobik2017-03-021-0/+1
* Remove expired ports:rene2017-03-021-1/+0
* (Readdition of audio/alac which was removed on 418056)ehaupt2017-02-261-0/+1
* New port: audio/gstreamer1-plugins-sndiotobik2017-02-161-0/+1
* Zita-resampler is a C++ library for resampling audio signals. It is designed toamdmi32017-02-011-0/+1
* - Autodetect the installed linux_base port and use LINUX_DEFAULT only astijl2017-02-011-3/+0
* Remove expired ports:rene2017-01-281-2/+0
* Remove expired ports:rene2017-01-151-2/+0
* New port: audio/ardour5pi2017-01-131-0/+1
* New port: audio/suilpi2017-01-111-0/+1
* New port: audio/lilvpi2017-01-111-0/+1
* New port: audio/sratompi2017-01-111-0/+1
* - Add ports for Nuvola Player 3 and its servicesavilla2017-01-041-0/+1
* Drop support for Linux Fedora 10 (ports part)rene2017-01-011-14/+0
* New port: audio/spectrogrampi2016-12-261-0/+1
* Remove expired port:rene2016-12-011-1/+0
* Sayonara is a small, clear, and fast audio player for Unix-like systems,danfe2016-12-011-0/+1
* USES=mono: simplify EXTRACT_ONLY, fix nuget-extract [1]dbn2016-11-281-0/+1
* Add shairport-sync 2.8.6, airPlay audio player with multi-room audioehaupt2016-11-211-0/+1
* audio/lv2: add new portjbeich2016-11-011-0/+1
* Add virtual_oss and it's graphical control panel virtual_oss_ctl.kwm2016-10-281-0/+2
* Add Linux CentOS 7 infrastructure ports.tijl2016-10-191-0/+14
* Move audio/squeezeboxserver to audio/logitechmediaserverwoodsb022016-10-061-6/+6
* eSpeak For Asterisk provides the "Espeak" dialplan application,madpilot2016-09-211-0/+1
* Flite For Asterisk provides the "Flite" dialplan application, whichmadpilot2016-09-211-0/+1
* Revive audio/exaile-develrm2016-08-211-0/+1
* A module for PulseAudio to support playing to sndio servers.pawel2016-08-191-0/+1
* The aucatctl utility sends MIDI messages to control sndiod and/orpawel2016-08-191-0/+1
* Add python3 version of audio/py-mutagen packagerm2016-08-161-0/+1
* Import SpeechRecognition 3.4.6kevlo2016-08-041-0/+1
* New port: audio/sndiopi2016-08-031-0/+1
* Add libg722, a software G.722 decoding/encoding library that issobomax2016-07-301-0/+1
* Remove expired ports without open PRs:rene2016-07-051-4/+0
* This is a Fluid (R3) General MIDI soundfonts, for use with any modern MIDIdanfe2016-07-021-0/+1
* Import audio/libsoxr, a sample-rate conversion libraryriggs2016-06-261-0/+1
* New port: audio/simonpi2016-05-301-0/+1
* Remove expired ports:rene2016-05-161-1/+0
* Add new port audio/forked-daapd, a DAAP (iTunes), MPD (Musicwoodsb022016-05-121-0/+1
* Hook py-soundcloud to the buildantoine2016-05-011-0/+1
* New port: audio/dsbmixer.rakuco2016-03-131-0/+1
* New port: audio/pd-cyclonepi2016-03-121-0/+1
* Remove expired ports:rene2016-03-071-1/+0
* This is a VU meter plugin for DeaDBeeF audio player.danfe2016-03-031-0/+1
* Remove expired ports:rene2016-03-011-2/+0
* Hook dream to the buildantoine2016-02-191-0/+1
* This is playback status plugin (widget) for DeaDBeeF audio player.danfe2016-01-311-0/+1
* This is a quick playlist search bar plugin for DeaDBeeF audio player.danfe2016-01-311-0/+1
* Add a port of waveform seekbar for DeaDBeeF audio player.danfe2016-01-311-0/+1
* Welcome Centos 6.7miwi2016-01-311-1/+0
* Add port of a better DeaDBeeF musical spectrum plugin. It offers variabledanfe2016-01-301-0/+1
* Import pulseaudio-libs-glib2 0.9.21. This is needed by net-im/skype4.kevlo2016-01-161-0/+1
* Ressurrect audio/kstreamripper and update to 0.7.100.rakuco2016-01-031-0/+1
* Update to upstream version 5.003, introduce SSE2-enabled i386 slave portriggs2016-01-021-0/+1
* 2015-11-26 audio/kstreamripper: Broken for more than 6 monthsrakuco2016-01-011-1/+0
* Remove expired ports:rene2015-12-311-1/+0
* New port: audio/codec2shurd2015-12-151-0/+1
* FPC ecosystem: Upgrade version 2.6.4 => 3.0.0marino2015-12-061-1/+0
* audio/festvox-cmu_us_*_arctic: Fixes as suggested by jbeichpi2015-12-031-0/+1
* New ports: audio/festvox-cmu_us_*_arcticpi2015-12-021-0/+6
* Remove expired ports:rene2015-11-291-15/+0
* Add a port of JACK output plugin for DeaDBeeF music player. There are fewdanfe2015-11-191-0/+1
* Add a port of up-to-date implementation of the MPRIS protocol for DeaDBeeFdanfe2015-11-161-0/+1
* Remove expired ports:rene2015-11-021-1/+0
* Rename audio/py-audiotools to match PyPI nomenclaturepawel2015-10-301-1/+1
* Python Audio Tools are a collection of audio handling programs which work frompawel2015-10-291-0/+1
* gnuspeech makes it easy to produce high quality computer speechamdmi32015-10-211-0/+1
* Update gstreamer1 ports to 1.6.0.kwm2015-09-261-0/+3
* Update MATE DE to 1.10.0.kwm2015-07-281-0/+1
* Pragha is a Lightweight Music Player, based on GTK, and SQLite.olivierd2015-07-211-0/+1
* Remove expired port:rene2015-07-171-1/+0
* Add gsound.kwm2015-07-031-0/+1
* Remove expired ports:rene2015-06-301-1/+0
* audio/linux-skype_oss_wrapper: add port.xmj2015-06-111-0/+1
* Ressurrect audio/beep and host source on my local areagarga2015-06-021-0/+1
* Update portaudio to v19/Remove portaudio2 [1]bapt2015-05-311-1/+0
* - Move audio/rubygem-shout to audio/rubygem-ruby-shoutsunpoet2015-05-281-1/+1
* Unbreak INDEXantoine2015-04-281-1/+1
* Add a port of Skype call recorder, version 8.0.danfe2015-04-231-0/+1
* Create a separate port for the Mediastreamer plugin in audio/bcg729tijl2015-04-171-0/+1
* Add a port of Flacon, nice graphical audio file extractor and encoder.danfe2015-03-311-1/+2
* Remove expired ports:rene2015-03-281-1/+0
* Xfce4-pulseaudio-plugin is a panel plugin for controlling an audio outputolivierd2015-03-271-0/+1
* Add audio/volumeiconlme2015-03-081-0/+1
* Add new port: audio/shairplayjbeich2015-02-281-0/+1
* Python bindings for the libdiscid CD-lookup library.jhale2015-02-261-0/+1
* Add audio/cantata.rakuco2015-02-191-0/+1
* Lollypop is music player. It provides:olivierd2015-02-081-0/+1
* Remove expired ports:rene2015-02-031-1/+0