On 11/11/2015 02:28 PM, Jakub Hrozek wrote:
Hi,
I think one of the prime reasons for #2861 was copy-pasting code. The
two attached patches reduce the code duplication and hopefully will make
future additions to Data Provider safer.
Ideas on different solutions are welcome!
Hi Jakub,
I am afraid that the first patch is inapplicable.
It is build up on 562a15a2d156b4b062acbf1f4e44e4cb7a4058d2 commit but
there is no such commit.
Regards
Petr
0001-DP-Reduce-code-duplication-in-the-callback-handlers.patch
From f6e929d4132a23d23a9016e43f4b870780c53032 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek<jhrozek(a)redhat.com>
Date: Wed, 11 Nov 2015 13:39:43 +0100
Subject: [PATCH 1/2] DP: Reduce code duplication in the callback handlers
Instead of calling sbus_request_return_and_finish() directly with the
same checks copied over, add a be_sbus_reply() helper instead.
---
pcech@albireo ~/sssd: (master) $ git am
../patch/0001-DP-Reduce-code-duplication-in-the-callback-handlers.patch
Applying: DP: Reduce code duplication in the callback handlers
error: patch failed: src/providers/data_provider_be.c:661
error: src/providers/data_provider_be.c: patch does not apply
Patch failed at 0001 DP: Reduce code duplication in the callback handlers
The copy of the patch that failed is found in:
/home/pcech/sssd/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
pcech@albireo ~/sssd: (master) $ git am --abort
pcech@albireo ~/sssd: (master) $ git am -i3
../patch/0001-DP-Reduce-code-duplication-in-the-callback-handlers.patch
Commit Body is:
--------------------------
DP: Reduce code duplication in the callback handlers
Instead of calling sbus_request_return_and_finish() directly with the
same checks copied over, add a be_sbus_reply() helper instead.
--------------------------
Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all a
Applying: DP: Reduce code duplication in the callback handlers
error: invalid object 100644 562a15a2d156b4b062acbf1f4e44e4cb7a4058d2
for 'src/providers/data_provider_be.c'
fatal: git-write-tree: error building trees
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 DP: Reduce code duplication in the callback handlers
The copy of the patch that failed is found in:
/home/pcech/sssd/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".