Changeset 658421f
- Timestamp:
- Apr 13, 2017, 6:43:22 PM (7 years ago)
- Parents:
- 678a7650 (diff), 5405fb1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- tehmoth <james2vegas@aim.com> (04/13/17 18:43:22)
- git-committer:
- GitHub <noreply@github.com> (04/13/17 18:43:22)
- Files:
-
- 3 added
- 3 deleted
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
rca1fb26a r7834bb5 1 # Generated by autoreconf 2 Makefile.in 3 /aclocal.m4 4 /autom4te.cache/ 5 /compile 6 /config.h.in 7 /config.h.in~ 8 /configure 9 /depcomp 10 /install-sh 11 /missing 12 /test-driver 13 14 # Generated by configure 15 Makefile 16 .deps/ 17 /config.cache 18 /config.h 19 /config.log 20 /config.status 21 /stamp-h1 22 23 # Generated by make 24 *.o 1 25 *.a 2 *.o 3 *.par 4 .deps 26 /BUILD_VERSION.mk 27 /barnowl 5 28 /bin/ 6 BUILD_VERSION.mk 7 META.yml 8 MYMETA.yml 9 Makefile 10 Makefile.in 11 Makefile.old 29 /gmarshal_funcs.c 30 /gmarshal_funcs.h 31 /owl_prototypes.h 32 /owl_prototypes.h.new 33 /perlglue.c 34 /varstubs.c 35 /version.c 36 /version.c.new 37 /zcrypt 38 39 # Generated by make check 40 /runtests.sh.log 41 /runtests.sh.trs 42 /test-suite.log 43 /tester 44 45 # Generated by make tags et al. 46 ID 12 47 TAGS 13 aclocal.m4 14 autom4te.cache 15 barnowl 16 blib 17 config.cache 18 config.h 19 config.h.in 20 config.h.in~ 21 config.log 22 config.status 23 configure 24 core 25 depcomp 26 gmarshal_funcs.c 27 gmarshal_funcs.h 28 inc/ 29 install-sh 30 jabber.log 31 missing 32 owl_prototypes.h 33 owl_prototypes.h.new 34 perlglue.c 35 pm_to_blib 36 runtests.sh.log 37 runtests.sh.trs 38 stamp-h1 39 test-driver 40 test-suite.log 41 tester 42 varstubs.c 43 version.c 44 version.c.new 45 zcrypt 48 tags 49 /GPATH 50 /GRTAGS 51 /GSYMS 52 /GTAGS 53 /cscope.files 54 /cscope.in.out 55 /cscope.out 56 /cscope.po.out -
.travis.yml
r48c09d4 rbecd617 1 1 language: perl 2 sudo: false 2 3 compiler: 3 4 - clang … … 9 10 - "5.16" 10 11 - "5.18" 11 - "5.19" 12 install: 13 - sudo apt-get update -q 14 # we actually want debhelper >= 7, libperl-dev >= 5.10.1-8, libzephyr-dev >= 3.0~beta 15 - sudo apt-get install -q autoconf autotools-dev debhelper dh-autoreconf libglib2.0-dev libkrb5-dev libncurses5-dev libncursesw5-dev libssl-dev libzephyr-dev pkg-config zip 12 - "5.20" 13 addons: 14 apt: 15 # we actually want debhelper >= 7, libperl-dev >= 5.10.1-8, libzephyr-dev >= 3.0~beta 16 packages: 17 - autoconf 18 - autotools-dev 19 - debhelper 20 - dh-autoreconf 21 - libglib2.0-dev 22 - libkrb5-dev 23 - libncurses5-dev 24 - libncursesw5-dev 25 - libssl-dev 26 - libzephyr-dev 27 - pkg-config 28 - zip 16 29 # perl things 17 30 # In lp:~barnowl/barnowl/packaging, we use apt-get. Here, we use cpanm. 18 31 # - sudo apt-get install libanyevent-perl libclass-accessor-perl libextutils-depends-perl libglib-perl libmodule-install-perl libnet-twitter-lite-perl libpar-perl libperl-dev 19 - cpanm AnyEvent Class::Accessor ExtUtils::Depends Glib Module::Install Net::Twitter::Lite PAR 20 script: "./autogen.sh && ./configure && make distcheck"32 # It's taken care of by the default install script 33 script: ./autogen.sh && ./configure && make distcheck -
ChangeLog
r441fd42 r678a7650 1 1.10 2 * No changes above what's already in 1.10rc1 3 4 1.10rc1 5 * Numerous autotools/build machinery fixes -andersk@mit.edu 6 * Numerous code correctness and simplification/cleanup fixes -andersk@mit.edu 7 * Add and use a cpanfile documenting perl module dependencies -jgross@mit.edu 8 * Add Travis configuration -jgross@mit.edu 9 * Avoid strchrnul -andersk@mit.edu 10 * Numerous IRC fixes -jgross@mit.edu 11 * Improve smartnarrow and smartfilter documentation -jgross@mit.edu 12 * filterproc: Rewrite using GIOChannel -andersk@mit.edu 13 * Implement :twitter-favorite -nelhage@nelhage.com 14 * Kill the client-side tweet length check. -nelhage@nelhage.com 15 * squelch the Twitter legacy_list_api warnings -nelhage@nelhage.com 16 * Use SSL for Twitter by default -adehnert@mit.edu 17 * Humanize zsigs -andersk@mit.edu 18 * Show Zephyr charset in info popup -andersk@mit.edu 19 * Fix Jabber SRV record support (at one point fixed connecting via jabber to google talk or facebook) -james2vegas@aim.com 20 * fix cmd_join in BarnOwl/Module/IRC.pm -james2vegas@aim.com 21 * Add a ~/.owl/ircchannels file, persist channels -jgross@mit.edu 22 * Added hooks for user going idle or active. -jgross@mit.edu 23 * Support channel-or-user IRC commands, and setup irc-msg to use it. -ezyang@mit.edu 24 * Refactor perl calls through a single method -jgross@mit.edu 25 * Really support building Perl modules from a separate builddir -andersk@mit.edu 26 * Get rid of all our embedded copies of Module::Install -andersk@mit.edu 27 * Don't let new_variable_* overriding previously set values -rnjacobs@mit.edu 28 * Messages sent to 'class messages' are not personal -jgross@mit.edu 29 * Expose message_matches_filter to perl -jgross@mit.edu 30 * Fail fast on -c filsrv, which most people won't have permission to send to -rnjacobs@mit.edu 31 * zcrypt: Use getopt_long for argument parsing -andersk@mit.edu 32 * zcrypt: Accept -help and --version -andersk@mit.edu 33 * barnowl --help: Write to stdout and exit successfully -andersk@mit.edu 34 * Don't swallow errors in :unsuball -davidben@mit.edu 35 * Allow testing in a separate build directory -andersk@mit.edu 36 * Add support for arbitrary Perl subs for getters and setters for barnowl variables -glasgall@mit.edu 37 * owl_zephyr_loadsubs: Don’t leak memory on error opening ~/.zephyr.subs -andersk@mit.edu 38 * Make :loadsubs reload instanced personals too -davidben@mit.edu 39 * Fix some undefined behavior in filter.c, caught by clang scan-build -jgross@mit.edu 40 * Die on a failed zephyr_zwrite; don't silently ignore it -jgross@mit.edu 41 * Fix a memory leak in zcrypt.c, caught by clang scan-build -jgross@mit.edu 42 * zcrypt: Make gpg stop messing around in ~/.gnupg -andersk@mit.edu 43 * Fix display of pseudologins -davidben@mit.edu 44 * Unbundle random Facebook module libraries -davidben@mit.edu 45 * Replace deprecated GLib < 2.31.0 APIs -andersk@mit.edu 46 * Abstract g->interrupt_lock -andersk@mit.edu 47 * zephyr: Replace outgoing default format with a small URL -geofft@mit.edu 48 1 49 1.9 50 * Update Jabber module for Net::DNS changes -james2vegas@aim.com 51 * Update and make configurable the Zephyr default format -adehnert@mit.edu 52 * Fix a crash when zcrypt fails -andersk@mit.edu 53 * Fix building with OpenSSL before 0.9.8 -andersk@mit.edu 54 * Make :loadsubs reload instanced personals too -davidben@mit.edu 55 * Make Perl zephyr_zwrite call die() when it fails -jgross@mit.edu 56 * Tell gpg calls from zcrypt to ignore ~/.gnupg -andersk@mit.edu 57 * Replace outgoing zephyr default format with a small URL -geofft@mit.edu 2 58 * Add getnumlines() to perl interface -asedeno@mit.edu 3 59 * Include names of invalid filters on filter errors -adehnert@mit.edu -
Makefile.am
rca1fb26a r392b5cf 2 2 3 3 GIT_DESCRIPTION := $(if $(wildcard $(srcdir)/.git),$(shell cd $(srcdir) && git describe --match='barnowl-*' HEAD 2>/dev/null)) 4 VERSION = $(if $(GIT_DESCRIPTION),$(GIT_DESCRIPTION:barnowl-%=%),@VERSION@) 5 -include BUILD_VERSION.mk 4 VERSION = $(if $(GIT_DESCRIPTION),$(GIT_DESCRIPTION:barnowl-%=%),$(DIST_VERSION)) 5 DIST_VERSION = @VERSION@ 6 -include $(srcdir)/DIST_VERSION.mk BUILD_VERSION.mk 6 7 7 8 FORCE: 8 9 BUILD_VERSION.mk: $(if $(filter-out $(BUILD_VERSION),$(VERSION)),FORCE) 9 10 echo 'BUILD_VERSION = $(VERSION)' > $@ 11 dist-hook:: $(if $(filter-out @VERSION@,$(VERSION)),dist-hook-version) 12 dist-hook-version: 13 echo 'DIST_VERSION = $(VERSION)' > $(distdir)/DIST_VERSION.mk 10 14 11 15 bin_PROGRAMS = bin/barnowl … … 14 18 endif 15 19 16 zcrypt_SOURCES = zcrypt.c filterproc.c version.c 20 zcrypt_SOURCES = zcrypt.c filterproc.c 21 nodist_zcrypt_SOURCES = version.c 17 22 18 23 check_PROGRAMS = bin/tester … … 104 109 105 110 CLEANFILES = $(BUILT_SOURCES) $(GEN_C) $(noinst_SCRIPTS) $(check_SCRIPTS) BUILD_VERSION.mk 111 MAINTAINERCLEANFILES = DIST_VERSION.mk 106 112 EXTRA_DIST = \ 107 113 autogen.sh \ … … 116 122 scripts \ 117 123 stubgen.pl \ 118 typemap 124 typemap \ 125 cpanfile 119 126 120 127 SUBDIRS = compat libfaim perl -
aim.c
r8258ea5 r7dcef03 1049 1049 wrapmsg=owl_text_wordwrap(stripmsg, 70); 1050 1050 nz_screenname=owl_aim_normalize_screenname(userinfo->sn); 1051 m=g_ new(owl_message, 1);1051 m=g_slice_new(owl_message); 1052 1052 owl_message_create_aim(m, 1053 1053 nz_screenname, -
buddy.c
rd4927a7 r7dcef03 72 72 { 73 73 owl_buddy_cleanup(b); 74 g_ free(b);74 g_slice_free(owl_buddy, b); 75 75 } -
buddylist.c
r3cdd6d2 r7dcef03 11 11 { 12 12 owl_buddy *b; 13 b=g_ new(owl_buddy, 1);13 b=g_slice_new(owl_buddy); 14 14 15 15 owl_buddy_create(b, OWL_PROTOCOL_AIM, screenname); … … 50 50 51 51 /* if not, create the login message */ 52 m=g_ new(owl_message, 1);52 m=g_slice_new(owl_message); 53 53 owl_message_create_aim(m, 54 54 screenname, … … 69 69 70 70 if (owl_buddylist_is_aim_buddy_loggedin(bl, screenname)) { 71 m=g_ new(owl_message, 1);71 m=g_slice_new(owl_message); 72 72 owl_message_create_aim(m, 73 73 screenname, -
cmd.c
rf271129 r7dcef03 35 35 void owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) { 36 36 owl_cmd *cmd; 37 cmd = g_ new(owl_cmd, 1);37 cmd = g_slice_new(owl_cmd); 38 38 owl_cmd_create_alias(cmd, alias_from, alias_to); 39 39 owl_perlconfig_new_command(cmd->name); … … 42 42 43 43 int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) { 44 owl_cmd * newcmd = g_ new(owl_cmd, 1);44 owl_cmd * newcmd = g_slice_new(owl_cmd); 45 45 if(owl_cmd_create_from_template(newcmd, cmd) < 0) { 46 g_ free(newcmd);46 g_slice_free(owl_cmd, newcmd); 47 47 return -1; 48 48 } … … 141 141 { 142 142 owl_cmd_cleanup(cmd); 143 g_ free(cmd);143 g_slice_free(owl_cmd, cmd); 144 144 } 145 145 -
commands.c
rca1fb26a r8fcd3e7 548 548 "optional color arguments are used they specifies the colors that\n" 549 549 "messages matching this filter should be displayed in.\n\n" 550 "SEE ALSO: view, viewclass, viewuser\n"),550 "SEE ALSO: smartfilter, smartnarrow, view, viewclass, viewuser\n"), 551 551 552 552 OWLCMD_ARGS("colorview", owl_command_colorview, OWL_CTX_INTERACTIVE, … … 585 585 "filter expression that will be dynamically created by BarnOwl and then\n" 586 586 "applied as the view's filter\n" 587 "SEE ALSO: filter, viewclass, viewuser\n"),587 "SEE ALSO: filter, smartfilter, smartnarrow, viewclass, viewuser\n"), 588 588 589 589 OWLCMD_ARGS("smartnarrow", owl_command_smartnarrow, OWL_CTX_INTERACTIVE, … … 599 599 " then narrow to the class and instance.\n" 600 600 "If '-r' or '--related' is specified, behave as though the\n" 601 " 'narrow-related' variable was inverted."), 601 " 'narrow-related' variable was inverted.\n\n" 602 "SEE ALSO: filter, smartfilter, view, viewclass, viewuser\n"), 602 603 603 604 OWLCMD_ARGS("smartfilter", owl_command_smartfilter, OWL_CTX_INTERACTIVE, … … 610 611 "If the curmsg is a class message, the filter is that class.\n" 611 612 "If the curmsg is a class message and '-i' is specified\n" 612 " the filter is to that class and instance.\n"), 613 " the filter is to that class and instance.\n\n" 614 "SEE ALSO: filter, smartnarrow, view, viewclass, viewuser\n"), 613 615 614 616 OWLCMD_ARGS("viewclass", owl_command_viewclass, OWL_CTX_INTERACTIVE, … … 618 620 "matching the specified class and switch the current view\n" 619 621 "to it.\n\n" 620 "SEE ALSO: filter, view, viewuser\n"),622 "SEE ALSO: filter, smartfilter, smartnarrow, view, viewuser\n"), 621 623 OWLCMD_ALIAS("vc", "viewclass"), 622 624 … … 627 629 "matching the specified user and switch the current\n" 628 630 "view to it.\n\n" 629 "SEE ALSO: filter, view, viewclass\n"),631 "SEE ALSO: filter, smartfilter, smartnarrow, view, viewclass\n"), 630 632 OWLCMD_ALIAS("vu", "viewuser"), 631 633 OWLCMD_ALIAS("viewperson", "viewuser"), -
configure.ac
r77dfeb1 r370d94d 1 1 dnl Process this file with autoconf to produce a configure script. 2 AC_INIT([BarnOwl],[1.1 0dev],[bug-barnowl@mit.edu])2 AC_INIT([BarnOwl],[1.11dev],[bug-barnowl@mit.edu]) 3 3 AM_INIT_AUTOMAKE([1.7.0 foreign std-options -Wall -Wno-portability]) 4 4 AM_MAINTAINER_MODE([enable]) -
context.c
rf271129 r7dcef03 10 10 if (!(mode & OWL_CTX_MODE_BITS)) 11 11 mode |= OWL_CTX_INTERACTIVE; 12 c = g_ new0(owl_context, 1);12 c = g_slice_new0(owl_context); 13 13 c->mode = mode; 14 14 c->data = data; … … 71 71 if (ctx->delete_cb) 72 72 ctx->delete_cb(ctx); 73 g_ free(ctx);73 g_slice_free(owl_context, ctx); 74 74 } -
editwin.c
r8258ea5 r7dcef03 68 68 static CALLER_OWN owl_editwin *owl_editwin_allocate(void) 69 69 { 70 owl_editwin *e = g_ new0(owl_editwin, 1);70 owl_editwin *e = g_slice_new0(owl_editwin); 71 71 e->refcount = 1; 72 72 return e; … … 87 87 oe_destroy_cbdata(e); 88 88 89 g_ free(e);89 g_slice_free(owl_editwin, e); 90 90 } 91 91 … … 373 373 owl_editwin_excursion *owl_editwin_begin_excursion(owl_editwin *e) 374 374 { 375 owl_editwin_excursion *x = g_ new(owl_editwin_excursion, 1);375 owl_editwin_excursion *x = g_slice_new(owl_editwin_excursion); 376 376 oe_save_excursion(e, x); 377 377 return x; … … 381 381 { 382 382 oe_restore_excursion(e, x); 383 g_ free(x);383 g_slice_free(owl_editwin_excursion, x); 384 384 } 385 385 -
filter.c
rc068c03 r7dcef03 18 18 owl_filter *f; 19 19 20 f = g_ new(owl_filter, 1);20 f = g_slice_new(owl_filter); 21 21 22 22 f->name=g_strdup(name); … … 69 69 if(!argc) return NULL; 70 70 71 fe = g_ new(owl_filterelement, 1);71 fe = g_slice_new(owl_filterelement); 72 72 owl_filterelement_create(fe); 73 73 … … 114 114 err: 115 115 owl_filterelement_cleanup(fe); 116 g_ free(fe);116 g_slice_free(owl_filterelement, fe); 117 117 return NULL; 118 118 } … … 132 132 op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip); 133 133 if(!op2) goto err; 134 tmp = g_ new(owl_filterelement, 1);134 tmp = g_slice_new(owl_filterelement); 135 135 if(!strcasecmp(argv[i], "and")) { 136 136 owl_filterelement_create_and(tmp, op1, op2); … … 152 152 if(op1) { 153 153 owl_filterelement_cleanup(op1); 154 g_ free(op1);154 g_slice_free(owl_filterelement, op1); 155 155 } 156 156 return NULL; … … 262 262 if (f->root) { 263 263 owl_filterelement_cleanup(f->root); 264 g_ free(f->root);264 g_slice_free(owl_filterelement, f->root); 265 265 } 266 266 if (f->name) 267 267 g_free(f->name); 268 g_ free(f);269 } 268 g_slice_free(owl_filter, f); 269 } -
filterelement.c
r7756dde r7dcef03 328 328 if (fe->left) { 329 329 owl_filterelement_cleanup(fe->left); 330 g_ free(fe->left);330 g_slice_free(owl_filterelement, fe->left); 331 331 } 332 332 if (fe->right) { 333 333 owl_filterelement_cleanup(fe->right); 334 g_ free(fe->right);334 g_slice_free(owl_filterelement, fe->right); 335 335 } 336 336 owl_regex_cleanup(&(fe->re)); -
filterproc.c
r7155955 re8db357 1 1 #include "filterproc.h" 2 2 #include <sys/wait.h> 3 #include < fcntl.h>3 #include <string.h> 4 4 #include <glib.h> 5 #include <poll.h>6 #include <string.h>7 #include <unistd.h>8 5 9 /* Even in case of error, send_receive is responsible for closing wfd 10 * (to EOF the child) and rfd (for consistency). */ 11 static int send_receive(int rfd, int wfd, const char *out, char **in) 6 struct filter_data { 7 const char **in; 8 const char *in_end; 9 GString *out_str; 10 GMainLoop *loop; 11 int err; 12 }; 13 14 static gboolean filter_stdin(GIOChannel *channel, GIOCondition condition, gpointer data_) 12 15 { 13 GString *str = g_string_new(""); 14 char buf[1024]; 15 nfds_t nfds; 16 int err = 0; 17 struct pollfd fds[2]; 16 struct filter_data *data = data_; 17 gboolean done = condition & (G_IO_ERR | G_IO_HUP); 18 18 19 fcntl(rfd, F_SETFL, O_NONBLOCK | fcntl(rfd, F_GETFL)); 20 fcntl(wfd, F_SETFL, O_NONBLOCK | fcntl(wfd, F_GETFL)); 21 22 fds[0].fd = rfd; 23 fds[0].events = POLLIN; 24 fds[1].fd = wfd; 25 fds[1].events = POLLOUT; 26 27 if(!out || !*out) { 28 /* Nothing to write. Close our end so the child doesn't hang waiting. */ 29 close(wfd); wfd = -1; 30 out = NULL; 19 if (condition & G_IO_OUT) { 20 gsize n; 21 GIOStatus ret = g_io_channel_write_chars(channel, *data->in, data->in_end - *data->in, &n, NULL); 22 *data->in += n; 23 if (ret == G_IO_STATUS_ERROR) 24 data->err = 1; 25 if (ret == G_IO_STATUS_ERROR || *data->in == data->in_end) 26 done = TRUE; 31 27 } 32 28 33 while(1) { 34 if(out && *out) { 35 nfds = 2; 36 } else { 37 nfds = 1; 38 } 39 err = poll(fds, nfds, -1); 40 if(err < 0) { 41 break; 42 } 43 if(out && *out) { 44 if(fds[1].revents & POLLOUT) { 45 err = write(wfd, out, strlen(out)); 46 if(err > 0) { 47 out += err; 48 } 49 if(err < 0) { 50 out = NULL; 51 } 52 } 53 if(!out || !*out || fds[1].revents & (POLLERR | POLLHUP)) { 54 close(wfd); wfd = -1; 55 out = NULL; 56 } 57 } 58 if(fds[0].revents & POLLIN) { 59 err = read(rfd, buf, sizeof(buf)); 60 if(err <= 0) { 61 break; 62 } 63 g_string_append_len(str, buf, err); 64 } else if(fds[0].revents & (POLLHUP | POLLERR)) { 65 err = 0; 66 break; 29 if (condition & G_IO_ERR) 30 data->err = 1; 31 32 if (done) 33 g_io_channel_shutdown(channel, TRUE, NULL); 34 return !done; 35 } 36 37 static gboolean filter_stdout(GIOChannel *channel, GIOCondition condition, gpointer data_) 38 { 39 struct filter_data *data = data_; 40 gboolean done = condition & (G_IO_ERR | G_IO_HUP); 41 42 if (condition & (G_IO_IN | G_IO_HUP)) { 43 gchar *buf; 44 gsize n; 45 GIOStatus ret = g_io_channel_read_to_end(channel, &buf, &n, NULL); 46 g_string_append_len(data->out_str, buf, n); 47 g_free(buf); 48 if (ret == G_IO_STATUS_ERROR) { 49 data->err = 1; 50 done = TRUE; 67 51 } 68 52 } 69 53 70 if (wfd >= 0) close(wfd); 71 close(rfd); 72 *in = g_string_free(str, err < 0); 73 return err; 54 if (condition & G_IO_ERR) 55 data->err = 1; 56 57 if (done) { 58 g_io_channel_shutdown(channel, TRUE, NULL); 59 g_main_loop_quit(data->loop); 60 } 61 return !done; 74 62 } 75 63 76 64 int call_filter(const char *const *argv, const char *in, char **out, int *status) 77 65 { 78 int err;79 66 GPid child_pid; 80 67 int child_stdin, child_stdout; … … 89 76 } 90 77 91 err = send_receive(child_stdout, child_stdin, in, out); 92 if (err == 0) { 93 waitpid(child_pid, status, 0); 94 } 95 return err; 78 if (in == NULL) in = ""; 79 GMainContext *context = g_main_context_new(); 80 struct filter_data data = {&in, in + strlen(in), g_string_new(""), g_main_loop_new(context, FALSE), 0}; 81 82 GIOChannel *channel = g_io_channel_unix_new(child_stdin); 83 g_io_channel_set_encoding(channel, NULL, NULL); 84 g_io_channel_set_flags(channel, g_io_channel_get_flags(channel) | G_IO_FLAG_NONBLOCK, NULL); 85 GSource *source = g_io_create_watch(channel, G_IO_OUT | G_IO_ERR | G_IO_HUP); 86 g_io_channel_unref(channel); 87 g_source_set_callback(source, (GSourceFunc)filter_stdin, &data, NULL); 88 g_source_attach(source, context); 89 g_source_unref(source); 90 91 channel = g_io_channel_unix_new(child_stdout); 92 g_io_channel_set_encoding(channel, NULL, NULL); 93 g_io_channel_set_flags(channel, g_io_channel_get_flags(channel) | G_IO_FLAG_NONBLOCK, NULL); 94 source = g_io_create_watch(channel, G_IO_IN | G_IO_ERR | G_IO_HUP); 95 g_io_channel_unref(channel); 96 g_source_set_callback(source, (GSourceFunc)filter_stdout, &data, NULL); 97 g_source_attach(source, context); 98 g_source_unref(source); 99 100 g_main_loop_run(data.loop); 101 102 g_main_loop_unref(data.loop); 103 g_main_context_unref(context); 104 105 waitpid(child_pid, status, 0); 106 g_spawn_close_pid(child_pid); 107 *out = g_string_free(data.out_str, data.err); 108 return data.err; 96 109 } -
functions.c
rca1fb26a rb61ad80 196 196 owl_message *m; 197 197 198 m=g_ new(owl_message, 1);198 m=g_slice_new(owl_message); 199 199 owl_message_create_admin(m, header, body); 200 200 … … 218 218 if (z->cc && owl_zwrite_is_personal(z)) { 219 219 /* create the message */ 220 owl_message *m = g_ new(owl_message, 1);220 owl_message *m = g_slice_new(owl_message); 221 221 owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), 0); 222 222 … … 231 231 232 232 /* create the message */ 233 m = g_ new(owl_message, 1);233 m = g_slice_new(owl_message); 234 234 owl_message_create_from_zwrite(m, z, owl_zwrite_get_message(z), i); 235 235 … … 251 251 if (!owl_global_is_aimloggedin(&g)) return(NULL); 252 252 253 m=g_ new(owl_message, 1);253 m=g_slice_new(owl_message); 254 254 owl_message_create_aim(m, 255 255 owl_global_get_aim_screenname(&g), … … 270 270 271 271 /* create the message */ 272 m=g_ new(owl_message, 1);272 m=g_slice_new(owl_message); 273 273 owl_message_create_loopback(m, body); 274 274 owl_message_set_direction_out(m); … … 516 516 /* create a message and put it on the message queue. This simulates 517 517 * an incoming message */ 518 min=g_ new(owl_message, 1);518 min=g_slice_new(owl_message); 519 519 mout=owl_function_make_outgoing_loopback(msg); 520 520 … … 1227 1227 time_t now; 1228 1228 va_list ap; 1229 va_start(ap, fmt);1230 1229 1231 1230 if (!owl_global_is_debug_fast(&g)) … … 1242 1241 (int) getpid(), tmpbuff, now - owl_global_get_starttime(&g)); 1243 1242 g_free(tmpbuff); 1243 1244 va_start(ap, fmt); 1244 1245 vfprintf(file, fmt, ap); 1246 va_end(ap); 1247 1245 1248 putc('\n', file); 1246 1249 fflush(file); 1247 1248 va_end(ap);1249 1250 } 1250 1251 … … 1472 1473 owl_fmtext_append_normal(&fm, "\n"); 1473 1474 owl_fmtext_appendf_normal(&fm, " Port : %i\n", ntohs(n->z_port)); 1475 owl_fmtext_appendf_normal(&fm, " Charset : %s\n", owl_zephyr_get_charsetstr(n)); 1474 1476 owl_fmtext_appendf_normal(&fm, " Auth : %s\n", owl_zephyr_get_authstr(n)); 1475 1477 … … 3481 3483 while (zaldptr) { 3482 3484 ZFreeALD(zaldptr->data); 3483 g_ free(zaldptr->data);3485 g_slice_free(ZAsyncLocateData_t, zaldptr->data); 3484 3486 zaldptr = g_list_next(zaldptr); 3485 3487 } … … 3491 3493 for (i = 0; i < anyone->len; i++) { 3492 3494 user = anyone->pdata[i]; 3493 zald = g_ new(ZAsyncLocateData_t, 1);3495 zald = g_slice_new(ZAsyncLocateData_t); 3494 3496 if (ZRequestLocations(zstr(user), zald, UNACKED, ZAUTH) == ZERR_NONE) { 3495 3497 *zaldlist = g_list_append(*zaldlist, zald); 3496 3498 } else { 3497 g_ free(zald);3499 g_slice_free(ZAsyncLocateData_t, zald); 3498 3500 } 3499 3501 } -
global.c
r120dac7 r7dcef03 553 553 e->g->filterlist = g_list_remove(e->g->filterlist, e->f); 554 554 owl_filter_delete(e->f); 555 g_ free(e);555 g_slice_free(owl_global_filter_ent, e); 556 556 } 557 557 558 558 void owl_global_add_filter(owl_global *g, owl_filter *f) { 559 owl_global_filter_ent *e = g_ new(owl_global_filter_ent, 1);559 owl_global_filter_ent *e = g_slice_new(owl_global_filter_ent); 560 560 e->g = g; 561 561 e->f = f; -
keybinding.c
rf271129 r7dcef03 14 14 CALLER_OWN owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc) 15 15 { 16 owl_keybinding *kb = g_ new(owl_keybinding, 1);16 owl_keybinding *kb = g_slice_new(owl_keybinding); 17 17 18 18 owl_function_debugmsg("owl_keybinding_init: creating binding for <%s> with desc: <%s>", keyseq, desc); 19 19 if (command && function_fn) { 20 g_ free(kb);20 g_slice_free(owl_keybinding, kb); 21 21 return NULL; 22 22 } else if (command && !function_fn) { … … 29 29 30 30 if (owl_keybinding_make_keys(kb, keyseq) != 0) { 31 g_ free(kb);31 g_slice_free(owl_keybinding, kb); 32 32 return NULL; 33 33 } … … 70 70 g_free(kb->desc); 71 71 g_free(kb->command); 72 g_ free(kb);72 g_slice_free(owl_keybinding, kb); 73 73 } 74 74 -
keymap.c
rf271129 r7dcef03 189 189 { 190 190 owl_keymap *km; 191 km = g_ new(owl_keymap, 1);191 km = g_slice_new(owl_keymap); 192 192 owl_keymap_init(km, name, desc, default_fn, prealways_fn, postalways_fn); 193 193 owl_keyhandler_add_keymap(kh, km); -
logging.c
r0792d99 r7dcef03 177 177 g_free(msg->message); 178 178 g_free(msg->filename); 179 g_ free(msg);179 g_slice_free(owl_log_entry, msg); 180 180 } 181 181 } … … 184 184 { 185 185 owl_log_entry *log_msg = NULL; 186 log_msg = g_ new(owl_log_entry,1);186 log_msg = g_slice_new(owl_log_entry); 187 187 log_msg->message = g_strdup(buffer); 188 188 log_msg->filename = g_strdup(filename); … … 266 266 * owl_log_shouldlog_message(void) 267 267 */ 268 m = g_ new(owl_message, 1);268 m = g_slice_new(owl_message); 269 269 /* recip_index = 0 because there can only be one recipient anyway */ 270 270 owl_message_create_from_zwrite(m, zw, text, 0); -
mainwin.c
rab88b05 r7dcef03 6 6 CALLER_OWN owl_mainwin *owl_mainwin_new(owl_window *window) 7 7 { 8 owl_mainwin *mw = g_ new(owl_mainwin, 1);8 owl_mainwin *mw = g_slice_new(owl_mainwin); 9 9 mw->curtruncated=0; 10 10 mw->lastdisplayed=-1; -
message.c
r2354e9a r7dcef03 70 70 71 71 if(pair == NULL) { 72 pair = g_ new(owl_pair, 1);72 pair = g_slice_new(owl_pair); 73 73 owl_pair_create(pair, attrname, NULL); 74 74 g_ptr_array_add(m->attributes, pair); … … 1019 1019 p = m->attributes->pdata[i]; 1020 1020 g_free(owl_pair_get_value(p)); 1021 g_ free(p);1021 g_slice_free(owl_pair, p); 1022 1022 } 1023 1023 … … 1030 1030 { 1031 1031 owl_message_cleanup(m); 1032 g_ free(m);1033 } 1032 g_slice_free(owl_message, m); 1033 } -
messagelist.c
r219f52c r7dcef03 3 3 CALLER_OWN owl_messagelist *owl_messagelist_new(void) 4 4 { 5 owl_messagelist *ml = g_ new(owl_messagelist, 1);5 owl_messagelist *ml = g_slice_new(owl_messagelist); 6 6 ml->list = g_ptr_array_new(); 7 7 return ml; … … 13 13 g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL); 14 14 g_ptr_array_free(ml->list, true); 15 g_ free(ml);15 g_slice_free(owl_messagelist, ml); 16 16 } 17 17 -
perl/lib/BarnOwl/Style/Default.pm
r732d5c0 rebc6f77 129 129 my $self = shift; 130 130 my $m = shift; 131 my $sender = $m->long_sender; 132 $sender =~ s/\n.*$//s; 131 my $sender = $self->humanize($m->long_sender, 1); 133 132 if (BarnOwl::getvar('colorztext') eq 'on') { 134 133 return " (" . $sender . '@color[default]' . ")"; -
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r5405fb1 rd4f33f1 562 562 "[" . $conn->alias . "] Reconnect cancelled"); 563 563 $conn->cancel_reconnect; 564 delete $ircnets{$conn->alias}; 565 } elsif (exists $ircnets{$conn->alias}) { # inconsistent state; no socket, but not yet deleted 566 BarnOwl::admin_message('IRC', 567 "[" . $conn->alias . "] Attempt to disconnect from a socketless connection; deleting it"); 564 568 delete $ircnets{$conn->alias}; 565 569 } -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
rbe43554 r4379288 437 437 } 438 438 439 sub rejoin_channels { 440 my $self = shift; 441 my @channels = @_; 442 # As reported in https://barnowl.mit.edu/ticket/274, if we reconnect to 443 # too many at once, the server rejects us. Empirically, this is about 444 # 20-26, so we set the cap at 15, then delay further joins for 5 seconds. 445 my $MAX_RECONNECT_CHANNELS = 15; 446 my $DELAY = 5; 447 foreach my $c (@channels[ 0 .. $MAX_RECONNECT_CHANNELS ]) { 448 $self->conn->send_msg(join => $c); 449 } 450 if ($MAX_RECONNECT_CHANNELS < $#channels) { 451 my $remaining = $#channels - $MAX_RECONNECT_CHANNELS; 452 my $cur_alias = $self->alias; 453 BarnOwl::admin_message('IRC', "[$cur_alias] Delaying $remaining autorejoins for $DELAY seconds"); 454 # if we don't assign the timer to anything, then it gets garbage 455 # collected, and never runs 456 $self->{autoconnect_channels_delay_timer} = BarnOwl::Timer->new({ 457 name => "IRC rejoin overflow timer ($remaining remaining)", 458 after => $DELAY, 459 cb => sub { 460 rejoin_channels($self, @channels[ $MAX_RECONNECT_CHANNELS .. $#channels ]); 461 } 462 }); 463 } 464 } 465 466 439 467 sub connected { 440 468 my $self = shift; … … 443 471 $self->cancel_reconnect; 444 472 if ($self->autoconnect_channels) { 445 for my $c (@{$self->autoconnect_channels}) { 446 $self->conn->send_msg(join => $c); 447 } 473 rejoin_channels($self, @{$self->autoconnect_channels}); 448 474 } 449 475 $self->conn->enable_ping(60, sub { -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r8258ea5 r41064be 1313 1313 { 1314 1314 my @answer = $packet->answer; 1315 return $answer[0] {target}, $answer[0]{port};1315 return $answer[0]->target, $answer[0]->port if @answer; 1316 1316 } 1317 1317 -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter.pm
rb8a3e00 r140429f 137 137 my $twitter_args = { username => $cfg->{user}, 138 138 password => $cfg->{password}, 139 source => 'barnowl', 139 source => 'barnowl', 140 ssl => 1, 141 legacy_lists_api => 0, 140 142 }; 141 143 if (defined $cfg->{service}) { … … 274 276 ); 275 277 278 BarnOwl::new_command( 'twitter-favorite' => sub { cmd_twitter_favorite(@_) }, 279 { 280 summary => 'Favorite the current Twitter message', 281 usage => 'twitter-favorite [ACCOUNT]', 282 description => <<END_DESCRIPTION 283 Favorite the current Twitter message using ACCOUNT (defaults to the 284 account that received the tweet). 285 END_DESCRIPTION 286 } 287 ); 288 276 289 BarnOwl::new_command( 'twitter-follow' => sub { cmd_twitter_follow(@_); }, 277 290 { … … 355 368 $account = $m->account unless defined($account); 356 369 find_account($account)->twitter_retweet($m); 370 return; 371 } 372 373 sub cmd_twitter_favorite { 374 my $cmd = shift; 375 my $account = shift; 376 my $m = BarnOwl::getcurmsg(); 377 if(!$m || $m->type ne 'Twitter') { 378 die("$cmd must be used with a Twitter message selected.\n"); 379 } 380 381 $account = $m->account unless defined($account); 382 find_account($account)->twitter_favorite($m); 357 383 return; 358 384 } -
perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm
r4ebbfbc r140429f 371 371 $self->twitter_direct($1, $2); 372 372 } elsif(defined $self->{twitter}) { 373 if(length($msg) > 140) {374 die("Twitter: Message over 140 characters long.\n");375 }376 373 $self->twitter_command('update', { 377 374 status => $msg, … … 432 429 } 433 430 431 sub twitter_favorite { 432 my $self = shift; 433 my $msg = shift; 434 435 if($msg->service ne $self->{cfg}->{service}) { 436 die("Cannot favorite a message from a different service.\n"); 437 } 438 $self->twitter_command(create_favorite => $msg->{status_id}); 439 } 440 441 434 442 sub twitter_follow { 435 443 my $self = shift; -
perlconfig.c
rca1fb26a r7dcef03 188 188 hash = (HV*)SvRV(msg); 189 189 190 m = g_ new(owl_message, 1);190 m = g_slice_new(owl_message); 191 191 owl_message_init(m); 192 192 -
perlglue.xs
rae2b830 r7dcef03 232 232 CODE: 233 233 { 234 s = g_ new(owl_style, 1);234 s = g_slice_new(owl_style); 235 235 owl_style_create_perl(s, name, newSVsv(object)); 236 236 owl_global_add_style(&g, s); -
popexec.c
re146cd7 r7dcef03 23 23 } 24 24 25 pe = g_ new(owl_popexec, 1);25 pe = g_slice_new(owl_popexec); 26 26 pe->winactive=0; 27 27 pe->pid=0; … … 179 179 if (pe->refcount<=0) { 180 180 owl_function_debugmsg("doing free of %p", pe); 181 g_ free(pe);181 g_slice_free(owl_popexec, pe); 182 182 } 183 183 } -
popwin.c
r6829afc r7dcef03 3 3 CALLER_OWN owl_popwin *owl_popwin_new(void) 4 4 { 5 owl_popwin *pw = g_ new0(owl_popwin, 1);5 owl_popwin *pw = g_slice_new0(owl_popwin); 6 6 7 7 pw->border = owl_window_new(NULL); … … 92 92 g_object_unref(pw->content); 93 93 94 g_ free(pw);94 g_slice_free(owl_popwin, pw); 95 95 } 96 96 -
runtests.sh
r5db8835 r7dcef03 1 1 #!/bin/sh 2 export G_SLICE=debug-blocks 2 3 exec env HARNESS_PERL=./tester prove --failures "${srcdir:=$(dirname "$0")}/t/" -
scripts/do-release
rb8a3e00 rbc308eb 1 #!/bin/sh -e 1 #!/bin/bash 2 set -eu 2 3 3 4 die() { … … 55 56 fi 56 57 58 [ -e Makefile.in ] || autoreconf -fvi 59 [ -e config.status ] || ./configure 60 make -j4 distcheck VERSION="$VERS" 61 62 echo 'Checking distributed files against Git:' 63 if comm -3 <(tar -tzf "$TAG.tar.gz" | grep -v '/$' | sed "s%^$TAG/%%" | sort) \ 64 <(git ls-files | sort) | grep -vxf scripts/dist-ignore; then 65 echo 66 echo 'Error: Please fix Makefile.am and/or scripts/dist-ignore.' 67 exit 1 68 fi 69 echo 'ok' 70 71 mv "$TAG.tar.gz" "$TGZ.tgz" 72 57 73 if ! [ "$no_tag" ]; then 58 74 if git cat-file -t "$TAG" > /dev/null 2>&1; then … … 65 81 fi 66 82 67 exittrap() { :; } 68 for sig in 1 2 13 15; do trap "exit $(($sig + 128))" $sig; done 69 trap 'exittrap' EXIT 70 71 TMPDIR=$(mktemp -d /tmp/barnowl.XXXXXX) 72 73 exittrap() { rm -rf "$TMPDIR"; } 74 75 git archive --format=tar --prefix="$TGZ/" "$TAG" | tar -x -C "$TMPDIR" 76 77 CODIR=$(pwd) 78 cd "$TMPDIR/$TGZ" 79 [ "$git" ] && perl -i -pe 's{^(AC_INIT\(\[[^\]]+\],\s*)\[([^\]]+)\]}{${1}['$VERS']}' configure.ac 80 autoreconf -fvi 81 rm -r autom4te.cache/ 82 cd "$TMPDIR" 83 tar czvf "$TGZ.tgz" "$TGZ" 84 cd "$CODIR" 85 86 mv "$TMPDIR/$TGZ.tgz" . 87 rm -rf "$TMPDIR" 88 89 exittrap() { :; } 90 91 echo "Created release tarball for BarnOwl $VERS in $(pwd)" 83 echo "Created release tarball for BarnOwl $VERS at $(pwd)/$TGZ.tgz" 92 84 echo "Remember to bump OWL_VERSION_STRING for future development." 93 85 -
select.c
r84a071f r7dcef03 41 41 if (t->destroy_cbdata) 42 42 t->destroy_cbdata(t->cbdata); 43 g_ free(t);43 g_slice_free(owl_task, t); 44 44 } 45 45 … … 47 47 { 48 48 GSource *source = g_idle_source_new(); 49 owl_task *t = g_ new0(owl_task, 1);49 owl_task *t = g_slice_new0(owl_task); 50 50 t->cb = cb; 51 51 t->cbdata = cbdata; -
style.c
r92ffd89 r7dcef03 103 103 { 104 104 owl_style_cleanup(s); 105 g_ free(s);105 g_slice_free(owl_style, s); 106 106 } -
tester.c
r6a8b519 r21dc927 25 25 int owl_history_regtest(void); 26 26 int call_filter_regtest(void); 27 int owl_smartstrip_regtest(void); 27 28 28 29 extern void owl_perl_xs_init(pTHX); … … 116 117 numfailures += owl_history_regtest(); 117 118 numfailures += call_filter_regtest(); 119 numfailures += owl_smartstrip_regtest(); 118 120 if (numfailures) { 119 121 fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures); … … 1018 1020 return numfailed; 1019 1021 } 1022 1023 int owl_smartstrip_regtest(void) 1024 { 1025 int numfailed = 0; 1026 1027 printf("# BEGIN testing owl_zephyr_smartstripped_user\n"); 1028 1029 #define CHECK_SMARTSTRIP(in, expected) \ 1030 do { \ 1031 char *__value = owl_zephyr_smartstripped_user(in); \ 1032 FAIL_UNLESS("owl_zephyr_smartstripped_user " in, \ 1033 strcmp((expected), __value) == 0); \ 1034 g_free(__value); \ 1035 } while (0) 1036 1037 CHECK_SMARTSTRIP("foo", "foo"); 1038 CHECK_SMARTSTRIP("foo.bar", "foo"); 1039 CHECK_SMARTSTRIP("foo/bar", "foo"); 1040 CHECK_SMARTSTRIP("host/bar", "host/bar"); 1041 CHECK_SMARTSTRIP("rcmd.bar", "rcmd.bar"); 1042 CHECK_SMARTSTRIP("daemon/bar", "daemon/bar"); 1043 CHECK_SMARTSTRIP("daemon.bar", "daemon.bar"); 1044 1045 CHECK_SMARTSTRIP("foo@ATHENA.MIT.EDU", "foo@ATHENA.MIT.EDU"); 1046 CHECK_SMARTSTRIP("foo.bar@ATHENA.MIT.EDU", "foo@ATHENA.MIT.EDU"); 1047 CHECK_SMARTSTRIP("foo/bar@ATHENA.MIT.EDU", "foo@ATHENA.MIT.EDU"); 1048 CHECK_SMARTSTRIP("host/bar@ATHENA.MIT.EDU", "host/bar@ATHENA.MIT.EDU"); 1049 CHECK_SMARTSTRIP("rcmd.bar@ATHENA.MIT.EDU", "rcmd.bar@ATHENA.MIT.EDU"); 1050 CHECK_SMARTSTRIP("daemon/bar@ATHENA.MIT.EDU", "daemon/bar@ATHENA.MIT.EDU"); 1051 CHECK_SMARTSTRIP("daemon.bar@ATHENA.MIT.EDU", "daemon.bar@ATHENA.MIT.EDU"); 1052 1053 printf("# END testing owl_zephyr_smartstripped_user\n"); 1054 1055 return numfailed; 1056 } -
util.c
r7b89e8c rcba6b9c 468 468 if (fstat(fileno(old), &st) != 0) { 469 469 owl_function_error("Cannot stat %s: %s", filename, strerror(errno)); 470 fclose(old); 470 471 return -1; 471 472 } … … 473 474 /* resolve symlinks, because link() fails on symlinks, at least on AFS */ 474 475 actual_filename = owl_util_recursive_resolve_link(filename); 475 if (actual_filename == NULL) 476 if (actual_filename == NULL) { 477 fclose(old); 476 478 return -1; /* resolving the symlink failed, but we already logged this error */ 479 } 477 480 478 481 newfile = g_strdup_printf("%s.new", actual_filename); -
variable.c
r9d4dfdc r94b9ee0 627 627 628 628 static owl_variable *owl_variable_newvar(int type, const char *name, const char *summary, const char *description, const char *validsettings) { 629 owl_variable *var = g_ new0(owl_variable, 1);629 owl_variable *var = g_slice_new0(owl_variable); 630 630 var->type = type; 631 631 var->name = g_strdup(name); … … 793 793 g_closure_unref(v->set_fromstring_fn); 794 794 795 g_ free(v);795 g_slice_free(owl_variable, v); 796 796 } 797 797 … … 1038 1038 CALLER_OWN char *owl_variable_bool_get_tostring_default(const owl_variable *v, void *dummy) 1039 1039 { 1040 bool val = owl_variable_get_bool(v); 1041 if (val == 0) { 1042 return g_strdup("off"); 1043 } else if (val == 1) { 1044 return g_strdup("on"); 1045 } else { 1046 return g_strdup("<invalid>"); 1047 } 1040 return g_strdup(owl_variable_get_bool(v) ? "on" : "off"); 1048 1041 } 1049 1042 -
viewwin.c
r7803326 r7dcef03 13 13 CALLER_OWN owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text) 14 14 { 15 owl_viewwin *v = g_ new0(owl_viewwin, 1);15 owl_viewwin *v = g_slice_new0(owl_viewwin); 16 16 owl_fmtext_init_null(&(v->fmtext)); 17 17 if (text) { … … 36 36 { 37 37 char *text; 38 owl_viewwin *v = g_ new0(owl_viewwin, 1);38 owl_viewwin *v = g_slice_new0(owl_viewwin); 39 39 40 40 owl_fmtext_copy(&(v->fmtext), fmtext); … … 424 424 g_object_unref(v->status); 425 425 owl_fmtext_cleanup(&(v->fmtext)); 426 g_ free(v);427 } 426 g_slice_free(owl_viewwin, v); 427 } -
zephyr.c
r441fd42 rff58239 125 125 owl_zephyr_loadsubs_helper(subs->subs, subs->nsubs); 126 126 deferred_subs = g_list_delete_link(deferred_subs, deferred_subs); 127 g_ free(subs);127 g_slice_free(owl_sub_list, subs); 128 128 } 129 129 … … 261 261 g_free(subs); 262 262 } else { 263 owl_sub_list *s = g_ new(owl_sub_list, 1);263 owl_sub_list *s = g_slice_new(owl_sub_list); 264 264 s->subs = subs; 265 265 s->nsubs = count; … … 283 283 #ifdef HAVE_LIBZEPHYR 284 284 FILE *file; 285 int fopen_errno; 285 286 char *tmp, *start; 286 287 char *buffer = NULL; … … 289 290 int subSize = 1024; 290 291 int count; 291 struct stat statbuff;292 292 293 293 subsfile = owl_zephyr_dotfile(".zephyr.subs", filename); 294 294 295 if (stat(subsfile, &statbuff) != 0) { 296 g_free(subsfile); 297 if (error_on_nofile == 1) 295 count = 0; 296 file = fopen(subsfile, "r"); 297 fopen_errno = errno; 298 g_free(subsfile); 299 if (!file) { 300 if (error_on_nofile == 1 || fopen_errno != ENOENT) 298 301 return -1; 299 302 return 0; 300 303 } 301 302 ZResetAuthentication();303 count = 0;304 file = fopen(subsfile, "r");305 g_free(subsfile);306 if (!file)307 return -1;308 304 309 305 subs = g_new(ZSubscription_t, subSize); … … 348 344 g_free(buffer); 349 345 346 ZResetAuthentication(); 350 347 return owl_zephyr_loadsubs_helper(subs, count); 351 348 #else … … 412 409 char *buffer = NULL; 413 410 int count; 414 struct stat statbuff;415 411 416 412 subs = g_new(ZSubscription_t, numSubs); 417 413 subsfile = owl_zephyr_dotfile(".anyone", filename); 418 414 419 if (stat(subsfile, &statbuff) == -1) {420 g_free(subs);421 g_free(subsfile);422 return 0;423 }424 425 ZResetAuthentication();426 415 count = 0; 427 416 file = fopen(subsfile, "r"); … … 445 434 fclose(file); 446 435 } else { 436 g_free(subs); 447 437 return 0; 448 438 } 449 439 g_free(buffer); 450 440 441 ZResetAuthentication(); 451 442 return owl_zephyr_loadsubs_helper(subs, count); 452 443 #else … … 1106 1097 } 1107 1098 1099 #ifdef HAVE_LIBZEPHYR 1100 const char *owl_zephyr_get_charsetstr(const ZNotice_t *n) 1101 { 1102 #ifdef ZCHARSET_UTF_8 1103 return ZCharsetToString(n->z_charset); 1104 #else 1105 return ""; 1106 #endif 1107 } 1108 #else 1109 const char *owl_zephyr_get_charsetstr(const void *n) 1110 { 1111 return ""; 1112 } 1113 #endif 1114 1108 1115 /* return auth string */ 1109 1116 #ifdef HAVE_LIBZEPHYR … … 1303 1310 CALLER_OWN char *owl_zephyr_smartstripped_user(const char *in) 1304 1311 { 1305 char *slash, *dot, *realm, *out; 1306 1307 out = g_strdup(in); 1308 1309 /* bail immeaditly if we don't have to do any work */ 1310 slash = strchr(out, '/'); 1311 dot = strchr(out, '.'); 1312 if (!slash && !dot) { 1313 return(out); 1314 } 1315 1316 if (!strncasecmp(out, OWL_ZEPHYR_NOSTRIP_HOST, strlen(OWL_ZEPHYR_NOSTRIP_HOST)) || 1317 !strncasecmp(out, OWL_ZEPHYR_NOSTRIP_RCMD, strlen(OWL_ZEPHYR_NOSTRIP_RCMD)) || 1318 !strncasecmp(out, OWL_ZEPHYR_NOSTRIP_DAEMON5, strlen(OWL_ZEPHYR_NOSTRIP_DAEMON5)) || 1319 !strncasecmp(out, OWL_ZEPHYR_NOSTRIP_DAEMON4, strlen(OWL_ZEPHYR_NOSTRIP_DAEMON4))) { 1320 return(out); 1321 } 1322 1323 realm = strchr(out, '@'); 1324 if (!slash && dot && realm && (dot > realm)) { 1325 /* There's no '/', and the first '.' is in the realm */ 1326 return(out); 1327 } 1328 1329 /* remove the realm from out, but hold on to it */ 1330 if (realm) realm[0]='\0'; 1331 1332 /* strip */ 1333 if (slash) slash[0] = '\0'; /* krb5 style user/instance */ 1334 else if (dot) dot[0] = '\0'; /* krb4 style user.instance */ 1335 1336 /* reattach the realm if we had one */ 1337 if (realm) { 1338 strcat(out, "@"); 1339 strcat(out, realm+1); 1340 } 1341 1342 return(out); 1312 int n = strcspn(in, "./"); 1313 const char *realm = strchr(in, '@'); 1314 if (realm == NULL) 1315 realm = in + strlen(in); 1316 1317 if (in + n >= realm || 1318 g_str_has_prefix(in, OWL_ZEPHYR_NOSTRIP_HOST) || 1319 g_str_has_prefix(in, OWL_ZEPHYR_NOSTRIP_RCMD) || 1320 g_str_has_prefix(in, OWL_ZEPHYR_NOSTRIP_DAEMON5) || 1321 g_str_has_prefix(in, OWL_ZEPHYR_NOSTRIP_DAEMON4)) 1322 return g_strdup(in); 1323 else 1324 return g_strdup_printf("%.*s%s", n, in, realm); 1343 1325 } 1344 1326 … … 1424 1406 if (ret == ZERR_NONE) { 1425 1407 /* Send a PSEUDO LOGIN! */ 1426 m = g_ new(owl_message, 1);1408 m = g_slice_new(owl_message); 1427 1409 owl_message_create_pseudo_zlogin(m, 0, zald->user, 1428 1410 location.host, … … 1437 1419 /* Send a PSEUDO LOGOUT! */ 1438 1420 if (notify) { 1439 m = g_ new(owl_message, 1);1421 m = g_slice_new(owl_message); 1440 1422 owl_message_create_pseudo_zlogin(m, 1, zald->user, "", "", ""); 1441 1423 owl_global_messagequeue_addmsg(&g, m); … … 1446 1428 } 1447 1429 ZFreeALD(zald); 1448 g_ free(zald);1430 g_slice_free(ZAsyncLocateData_t, zald); 1449 1431 } 1450 1432 } … … 1513 1495 1514 1496 /* create the new message */ 1515 m=g_ new(owl_message, 1);1497 m=g_slice_new(owl_message); 1516 1498 owl_message_create_from_znotice(m, ¬ice); 1517 1499 -
zwrite.c
r919cbf2 r7dcef03 3 3 CALLER_OWN owl_zwrite *owl_zwrite_new_from_line(const char *line) 4 4 { 5 owl_zwrite *z = g_ new(owl_zwrite, 1);5 owl_zwrite *z = g_slice_new(owl_zwrite); 6 6 if (owl_zwrite_create_from_line(z, line) != 0) { 7 g_ free(z);7 g_slice_free(owl_zwrite, z); 8 8 return NULL; 9 9 } … … 13 13 CALLER_OWN owl_zwrite *owl_zwrite_new(int argc, const char *const *argv) 14 14 { 15 owl_zwrite *z = g_ new(owl_zwrite, 1);15 owl_zwrite *z = g_slice_new(owl_zwrite); 16 16 if (owl_zwrite_create(z, argc, argv) != 0) { 17 g_ free(z);17 g_slice_free(owl_zwrite, z); 18 18 return NULL; 19 19 } … … 356 356 { 357 357 owl_zwrite_cleanup(z); 358 g_ free(z);358 g_slice_free(owl_zwrite, z); 359 359 } 360 360
Note: See TracChangeset
for help on using the changeset viewer.