Lawd yes it needs to be refactored. Y'all quit complaining about my copy and paste haste haha. I will clean it up. The other is just me being overly cautious I reckon. On Jan 20, 2016 3:25 AM, "Andrew Williams" <a...@andywilliams.me> wrote:
> Hi, > > I happened to notice this is the same code 3 times, can it not be > refactored to a different method and called 3 times? > If I had my testing hat on I'd say that method also could be well rested to > validate the other questions of how many char comparisons are needed :) > > Cheers, > Andrew > > On Tue, 19 Jan 2016 at 21:12, Stephen Houston <smhousto...@gmail.com> > wrote: > > > okra pushed a commit to branch master. > > > > > > > http://git.enlightenment.org/apps/ephoto.git/commit/?id=ff28d742535f18691f9e7985c70612bed2c759ba > > > > commit ff28d742535f18691f9e7985c70612bed2c759ba > > Author: Stephen Houston <smhousto...@gmail.com> > > Date: Tue Jan 19 15:10:37 2016 -0600 > > > > Ephoto: Only update thumbs on monitor call when the thumb is in the > > current directory. > > --- > > src/bin/ephoto_main.c | 30 ++++++++++++++++++++++++++++++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c > > index d27c1d0..858ed06 100644 > > --- a/src/bin/ephoto_main.c > > +++ b/src/bin/ephoto_main.c > > @@ -462,6 +462,16 @@ _monitor_created(void *data, int type EINA_UNUSED, > > void *event) > > { > > Ephoto *ephoto = data; > > Eio_Monitor_Event *ev = event; > > + char file[PATH_MAX], dir[PATH_MAX], p[PATH_MAX]; > > + > > + snprintf(file, PATH_MAX, "%s", ev->filename); > > + snprintf(p, PATH_MAX, "%s", ephoto->config->directory); > > + snprintf(dir, PATH_MAX, "%s", dirname(file)); > > + > > + if (strlen(p) != strlen(dir)) > > + return ECORE_CALLBACK_PASS_ON; > > + if (strcmp(p, dir)) > > + return ECORE_CALLBACK_PASS_ON; > > > > if (!strncmp("image/", efreet_mime_type_get(ev->filename), 6)) > > { > > @@ -515,6 +525,16 @@ _monitor_deleted(void *data, int type EINA_UNUSED, > > void *event) > > { > > Ephoto *ephoto = data; > > Eio_Monitor_Event *ev = event; > > + char file[PATH_MAX], dir[PATH_MAX], p[PATH_MAX]; > > + > > + snprintf(file, PATH_MAX, "%s", ev->filename); > > + snprintf(p, PATH_MAX, "%s", ephoto->config->directory); > > + snprintf(dir, PATH_MAX, "%s", dirname(file)); > > + > > + if (strlen(p) != strlen(dir)) > > + return ECORE_CALLBACK_PASS_ON; > > + if (strcmp(p, dir)) > > + return ECORE_CALLBACK_PASS_ON; > > > > if (!strncmp("image/", efreet_mime_type_get(ev->filename), 6)) > > { > > @@ -545,6 +565,16 @@ _monitor_modified(void *data, int type EINA_UNUSED, > > void *event) > > { > > Ephoto *ephoto = data; > > Eio_Monitor_Event *ev = event; > > + char file[PATH_MAX], dir[PATH_MAX], p[PATH_MAX]; > > + > > + snprintf(file, PATH_MAX, "%s", ev->filename); > > + snprintf(p, PATH_MAX, "%s", ephoto->config->directory); > > + snprintf(dir, PATH_MAX, "%s", dirname(file)); > > + > > + if (strlen(p) != strlen(dir)) > > + return ECORE_CALLBACK_PASS_ON; > > + if (strcmp(p, dir)) > > + return ECORE_CALLBACK_PASS_ON; > > > > if (!strncmp("image/", efreet_mime_type_get(ev->filename), 6)) > > { > > > > -- > > > > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel