Merge branch 'master' of github.com:urbit/urbit into king-haskell

This commit is contained in:
Benjamin Summers 2019-12-19 08:13:34 -08:00
commit 5b931657c8
47 changed files with 578 additions and 285 deletions

View File

@ -1,5 +1,6 @@
b <benjamin@tlon.io>
b <benjamin@tlon.io> <42358674+benjamin-tlon@users.noreply.github.com>
b <benjamin@tlon.io> <benjamin@bsummers.me>
BernardoDeLaPlaz <BernardoDeLaPlaz@users.noreply.github.com> <40804016+BernardoDeLaPlaz@users.noreply.github.com>
BernardoDeLaPlaz <BernardoDeLaPlaz@users.noreply.github.com> <tjic_BernardoDeLaPlaz_github@tjic.com>
Elliot Glaysher <elliot@tlon.io> <glaysher@umich.edu>

View File

@ -281,6 +281,6 @@ Questions or other communications about contributing to Urbit can go to
[mail]: mailto:support@urbit.org
[list]: https://groups.google.com/a/urbit.org/forum/#!forum/dev
[repo]: https://github.com/urbit/urbit
[reba]: https://www.atlassian.com/git/tutorials/merging-vs-rebasing
[reba]: https://git-rebase.io/
[issu]: https://github.com/urbit/urbit/issues
[hoon]: https://urbit.org/docs/learn/hoon/style/

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:04735cc4764f9a3e6c4fb5b046a6b9590664fe9f644578c58f3bc6acc911b723
size 9606039
oid sha256:d2c08caf6f69f9fa349003da923d0b6507a8b6df763a0ee491f195a937630843
size 9620244

View File

@ -74,8 +74,13 @@ rec {
};
image = import ./image {
inherit pkgs urbit;
pill = bootsolid;
inherit pkgs herb urbit solid;
};
image-ropsten = import ./image {
inherit pkgs herb urbit;
brass = brass-ropsten;
ivory = ivory-ropsten;
};
}

View File

@ -1,6 +1,17 @@
{ pkgs, urbit, pill }:
{ pkgs
, herb
, urbit
, solid ? null
, brass ? null
, ivory ? null
}:
pkgs.dockerTools.buildImage {
let
link = pill: path:
if pill == null then ""
else "${pkgs.coreutils}/bin/ln -sf ${pill} ${path}";
in pkgs.dockerTools.buildImage {
name = urbit.meta.name;
runAsRoot = ''
@ -8,23 +19,22 @@ pkgs.dockerTools.buildImage {
set -euo pipefail
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH
${pkgs.dockerTools.shadowSetup}
mkdir -p /bin /share /data /tmp
mkdir -p /share /data /tmp
${pkgs.coreutils}/bin/ln -sf ${pill} /share/urbit.pill
${pkgs.coreutils}/bin/ln -sf ${entrypoint} /bin/urbit
${link solid "/share/solid.pill"}
${link brass "/share/brass.pill"}
${link ivory "/share/ivory.pill"}
'';
contents = [ urbit herb ];
config = {
Entrypoint = [ "urbit" ];
Entrypoint = [ urbit.meta.name ];
WorkingDir = "/data";
Env = [ "PATH=/bin" ];
Volumes = {
"/data" = {};
};

View File

@ -88,7 +88,8 @@
^- card:agent:gall
=/ args=vase !>
:* %watch /[dap]
url.state ~m5 launch:contracts:azimuth
url.state =(%czar (clan:title our)) ~m5
launch:contracts:azimuth
~[azimuth:contracts:azimuth]
(topics whos.state)
==

View File

@ -8,7 +8,7 @@
=> |%
+$ card card:agent:gall
+$ app-state
$: %2
$: %3
dogs=(map path watchdog)
==
::
@ -92,17 +92,52 @@
%- (slog leaf+"upgrading eth-watcher from %1" ~)
:_ old-state(- %2)
%+ turn ~(tap by dogs.old-state)
|= [=path dog=watchdog]
|= [=path dog=watchdog-1]
(wait-shortcut path now.bowl)
::
[cards-1 this(state ?>(?=(%2 -.old-state) old-state))]
=? old-state ?=(%2 -.old-state)
%- (slog leaf+"upgrading eth-watcher from %2" ~)
^- app-state
%= old-state
- %3
dogs
%- ~(run by dogs.old-state)
|= dog=watchdog-1
%= dog
-> [| ->.dog]
==
==
::
[cards-1 this(state ?>(?=(%3 -.old-state) old-state))]
::
+$ app-states
$%(app-state-0 app-state-1 app-state)
$%(app-state-0 app-state-1 app-state-2 app-state)
::
+$ app-state-2
$: %2
dogs=(map path watchdog-1)
==
::
+$ app-state-1
$: %1
dogs=(map path watchdog)
dogs=(map path watchdog-1)
==
::
+$ watchdog-1
$: config-1
running=(unit =tid:spider)
=number:block
=pending-logs
=history
blocks=(list block)
==
::
+$ config-1
$: url=@ta
refresh-rate=@dr
from=number:block
contracts=(list address:ethereum)
=topics
==
::
+$ app-state-0
@ -149,12 +184,12 @@
=/ already (~(has by dogs.state) path.poke)
~? &(already restart)
[dap.bowl 'overwriting existing watchdog on' path.poke]
=/ wait-cards
=/ wait-cards=(list card)
?: already
~
[(wait-shortcut path.poke now.bowl) ~]
::
=/ restart-cards
=/ restart-cards=(list card)
=/ dog (~(get by dogs.state) path.poke)
?. ?& restart
?=(^ dog)
@ -162,7 +197,8 @@
==
~
=/ =cage [%spider-stop !>([u.running.u.dog &])]
[%pass [%starting path] %agent [our.bowl %spider] %poke cage]
:_ ~
`card`[%pass [%starting path.poke] %agent [our.bowl %spider] %poke cage]
=/ new-dog
=/ dog=watchdog
?: restart *watchdog
@ -172,7 +208,7 @@
number from.config.poke
==
=. dogs.state (~(put by dogs.state) path.poke new-dog)
[wait-cards this]
[(weld wait-cards restart-cards) this]
::
%clear
=. dogs.state (~(del by dogs.state) path.poke)
@ -217,6 +253,9 @@
::
[%x %dogs ~]
``noun+!>(~(key by dogs.state))
::
[%x %dogs %configs ~]
``noun+!>((~(run by dogs.state) |=(=watchdog -.watchdog)))
==
::
++ on-agent

View File

@ -205,6 +205,7 @@
!> ^- poke:eth-watcher
:+ %watch /[dap.bowl]
:* node-url
|
refresh-rate
public:mainnet-contracts
~[azimuth delegated-sending]:mainnet-contracts

View File

@ -0,0 +1,4 @@
:- %say
|= [[now=@da *] *]
:- %noun
.^(state-eth-node:jael j//=sources/(scot %da now))

View File

@ -4,6 +4,7 @@
|%
+$ config
$: url=@ta
eager=?
refresh-rate=@dr
from=number:block
contracts=(list address:ethereum)

View File

@ -2217,17 +2217,29 @@
^+ peer-core
:: send ack unconditionally
::
=. peer-core (emit (got-duct bone) %give %boon message)
=. peer-core (run-message-sink bone %done ok=%.y)
::
?. ?=([%hear * * ok=%.n] task)
:: fresh boon; give message to client vane
::
%- (trace msg.veb |.("boon {<her.channel^bone>}"))
(emit (got-duct bone) %give %boon message)
%- (trace msg.veb |.("boon {<her.channel^bone -.task>}"))
peer-core
:: we previously crashed on this message; notify client vane
::
%- (trace msg.veb |.("crashed on boon {<her.channel^bone>}"))
(emit (got-duct bone) %give %lost ~)
%- (trace msg.veb |.("crashed on boon {<her.channel^bone -.task>}"))
boon-to-lost
:: +boon-to-lost: convert all boons to losts
::
++ boon-to-lost
^+ peer-core
=. moves
%+ turn moves
|= =move
?. ?=([* %give %boon *] move)
move
[duct.move %give %lost ~]
peer-core
:: +on-sink-nack-trace: handle nack-trace received by |message-sink
::
++ on-sink-nack-trace
@ -3009,7 +3021,9 @@
::
?: already-heard-fragment
?: is-last-fragment
%- (trace rcv.veb |.("hear last dupe {<her.channel^seq>}"))
%- %+ trace rcv.veb |.
=/ data [her.channel seq last-heard.state last-acked.state]
"hear last dupe {<data>}"
message-sink
%- (trace rcv.veb |.("send dupe ack {<her.channel^seq^fragment-num>}"))
(give %send seq %& fragment-num)

View File

@ -1590,8 +1590,8 @@
=/ channel=(unit channel)
(~(get by session.channel-state.state) channel-id)
?~ channel
~& [%received-event-for-nonexistent-channel channel-id]
[~ state]
:_ state :_ ~
[duct %pass /flog %d %flog %crud %eyre-no-channel >id=channel-id< ~]
::
=/ event-id next-id.u.channel
::

View File

@ -77,8 +77,11 @@
$% $: %a :: to %ames
$>(%plea task:able:ames) :: send request message
== ::
$: %g :: to self
$>(%deal task:able:gall) :: set ethereum source
$: %b :: to %behn
$>(%wait task:able:behn) :: set timer
== ::
$: %g :: to %gall
$>(%deal task:able:gall) :: talk to app
== ::
$: %j :: to self
$>(%listen task) :: set ethereum source
@ -91,11 +94,14 @@
:: ::
+$ sign :: in result $<-
$~ [%a %done ~] ::
$% $: %a
$% $: %a ::
$% $>(%boon gift:able:ames) :: message response
$>(%done gift:able:ames) :: message (n)ack
$>(%lost gift:able:ames) :: lost boon
== ==
== == ::
$: %b ::
$>(%wake gift:able:behn) ::
== ::
$: %g ::
$> $? %onto ::
%unto ::
@ -257,14 +263,14 @@
=. sig.own.pki sig.seed.tac
:: load our initial public key
::
=/ spon-ship=(unit ship)
=/ flopped-spon (flop spon.tac)
?~(flopped-spon ~ `ship.i.flopped-spon)
=. pos.zim.pki
=/ cub (nol:nu:crub:crypto key.seed.tac)
%+ ~(put by pos.zim.pki)
our
=/ spon-ship
=/ flopped-spon (flop spon.tac)
?~(flopped-spon ~ `ship.i.flopped-spon)
[1 lyf.seed.tac (my [lyf.seed.tac [1 pub:ex:cub]] ~) spon-ship]
[0 lyf.seed.tac (my [lyf.seed.tac [1 pub:ex:cub]] ~) spon-ship]
:: our initial private key
::
=. lyf.own.pki lyf.seed.tac
@ -298,17 +304,33 @@
(~(gas by points) spon-points)
=. +>.$
%- curd =< abet
(public-keys:~(feel su hen our pki etn) %full points)
(public-keys:~(feel su hen our now pki etn) %full points)
::
:: start subscriptions
::
:: get everything from azimuth-tracker because jael subscriptions
:: seem to be flaky for now
::
=. +>.$ (poke-watch hen %azimuth-tracker nod.own.pki)
=. +>.$
%- curd =< abet
(sources:~(feel su hen our pki etn) ~ [%| %azimuth-tracker])
:: get everything from azimuth-tracker because jael subscriptions
:: seem to be flaky for now
::
?: &
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%| %azimuth-tracker])
::
?- (clan:title our)
%czar
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%| %azimuth-tracker])
::
*
=. +>.$
%- curd =< abet
%+ sources:~(feel su hen our now pki etn)
(silt (turn spon-points head))
[%| %azimuth-tracker]
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%& (need spon-ship)])
==
::
=. moz
%+ weld moz
@ -376,7 +398,7 @@
%listen
~& [%jael-listen whos source]:tac
%- curd =< abet
(sources:~(feel su hen our pki etn) [whos source]:tac)
(sources:~(feel su hen our now pki etn) [whos source]:tac)
::
:: cancel all trackers from duct
:: {$nuke whos=(set ship)}
@ -408,7 +430,7 @@
::
%rekey
%- curd =< abet
(private-keys:~(feel su hen our pki etn) life.tac ring.tac)
(private-keys:~(feel su hen our now pki etn) life.tac ring.tac)
::
:: update private keys
::
@ -420,14 +442,14 @@
~& [%not-our-moon ship.tac]
+>.$
%- curd =< abet
(~(new-event su hen our pki etn) [ship udiff]:tac)
(~(new-event su hen our now pki etn) [ship udiff]:tac)
::
:: watch public keys
:: [%public-keys ships=(set ship)]
::
%public-keys
%- curd =< abet
(~(public-keys ~(feed su hen our pki etn) hen) ships.tac)
(~(public-keys ~(feed su hen our now pki etn) hen) ships.tac)
::
:: seen after breach
:: [%meet our=ship who=ship]
@ -463,7 +485,7 @@
:: {$private-keys $~}
::
%private-keys
(curd abet:~(private-keys ~(feed su hen our pki etn) hen))
(curd abet:~(private-keys ~(feed su hen our now pki etn) hen))
::
%wegh
%_ +>
@ -508,7 +530,7 @@
^+ +>
?- hin
[%a %done *]
?~ error.hin ~&(%ares-fine +>.$)
?~ error.hin +>.$
~& [%done-bad tag.u.error.hin]
%- (slog tang.u.error.hin)
::TODO fail:et
@ -517,13 +539,26 @@
[%a %boon *]
=+ ;; [%public-keys-result =public-keys-result] payload.hin
%- curd =< abet
(public-keys:~(feel su hen our pki etn) public-keys-result)
(public-keys:~(feel su hen our now pki etn) public-keys-result)
::
[%a %lost *]
:: TODO: better error handling
::
~| %jael-ames-lost
!!
::
[%b %wake *]
?^ error.hin
%- %+ slog
leaf+"jael unable to resubscribe, run :azimuth-tracker|listen"
u.error.hin
+>.$
?> ?=([%breach @ ~] tea)
=/ =source-id (slav %ud i.t.tea)
=/ =source (~(got by sources.etn) source-id)
=/ ships (~(get ju ship-sources-reverse.etn) source-id)
%- curd =< abet
(sources:~(feel su hen our now pki etn) ships source)
::
[%g %onto *]
~& [%jael-onto tea hin]
@ -549,7 +584,7 @@
=* app i.tea
=/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin)
%- curd =< abet
(~(new-event su hen our pki etn) peer-sign)
(~(new-event su hen our now pki etn) peer-sign)
==
==
:: :: ++curd:of
@ -575,14 +610,15 @@
=| moz=(list move)
=| $: hen=duct
our=ship
now=@da
state-pki
state-eth-node
==
:: moz: moves in reverse order
:: pki: relative urbit state
::
=* pki ->+<
=* etn ->+>
=* pki ->+>-
=* etn ->+>+
|%
++ this-su .
:: :: ++abet:su
@ -799,9 +835,18 @@
?& ?=(^ point)
(gth rift.point.i.pointl rift.u.point)
==
%+ public-keys-give
(subscribers-on-ship who.i.pointl)
[%breach who.i.pointl]
=. ..feel
%+ public-keys-give
(subscribers-on-ship who.i.pointl)
[%breach who.i.pointl]
=/ sor (~(get by sources-reverse) %& who.i.pointl)
?~ sor
..feel
:: delay resubscribing because Ames is going to clear any
:: messages we send now.
::
(emit hen %pass /breach/(scot %ud u.sor) %b %wait now)
::
=. ..feel
%+ public-keys-give
(subscribers-on-ship who.i.pointl)
@ -863,11 +908,6 @@
++ sources
|= [whos=(set ship) =source]
^+ ..feel
?: ?=(%& -.source)
=/ send-message
|= =message
[hen %pass /public-keys %a %plea p.source %j /public-keys message]
(emit (send-message %public-keys whos))
=^ =source-id this-su (get-source-id source)
=. ..feed
?~ whos
@ -882,6 +922,12 @@
%- ~(gas ju ship-sources-reverse.etn)
(turn whol |=(=ship [source-id ship]))
..feed
::
?: ?=(%& -.source)
=/ send-message
|= =message
[hen %pass /public-keys %a %plea p.source %j /public-keys message]
(emit (send-message %public-keys whos))
(peer p.source whos)
--
::

View File

@ -2185,13 +2185,17 @@
%disavow ~|(%udiff-to-diff-disavow !!)
%spon `[%spon sponsor.a-point sponsor.a-udiff]
%rift
?: (gth rift.a-udiff rift.a-point)
~? !=(rift.a-udiff +(rift.a-point))
[%udiff-to-diff-skipped a-udiff a-point]
`[%rift rift.a-point rift.a-udiff]
~
?. (gth rift.a-udiff rift.a-point)
~
~? !=(rift.a-udiff +(rift.a-point))
[%udiff-to-diff-skipped-rift a-udiff a-point]
`[%rift rift.a-point rift.a-udiff]
::
%keys
?. (gth life.a-udiff life.a-point)
~
~? !=(life.a-udiff +(life.a-point))
[%udiff-to-diff-skipped-life a-udiff a-point]
:^ ~ %keys
[life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])]
[life crypto-suite pass]:a-udiff

View File

@ -7,6 +7,7 @@
+$ state
$: logs=(list az-log) :: oldest logs first
lives=(map ship [lyfe=life rut=rift])
tym=@da
==
::
+$ azimuth-command
@ -22,19 +23,34 @@
|= args=vase
=/ m (strand ,vase)
^- form:m
;< ~ bind:m (watch-our:strandio /effect/request %aqua /effect/request)
;< ~ bind:m (watch-our:strandio /effect/request %aqua /effect/request)
:: need blits for raw-ship to check booted
::
;< ~ bind:m (watch-our:strandio /effect/blit %aqua /effect/blit)
;< ~ bind:m
%- (main-loop:strandio ,state)
;< ~ bind:m (watch-our:strandio /effect/blit %aqua /effect/blit)
:: start timer to advance 10 blocks every 20 seconds
;< now=@da bind:m get-time:strandio
=/ a-state=state [~ ~ (add now ~s40)]
;< ~ bind:m (send-wait:strandio tym.a-state)
;< ~ bind:m
%- (main-loop:strandio ,_a-state)
:~ |=(=state ~(handle-unix-effect core state))
|=(=state ~(handle-poke core state))
|=(=state ~(handle-wake core state))
pure:(strand ,state)
==
(pure:m *vase)
::
|_ =state
++ handle-wake
=/ m (strand ,_state)
^- form:m
;< ~ bind:m ((handle:strandio ,~) (take-wake:strandio `tym.state))
~& >> 'spamming logs'
;< now=@da bind:m get-time:strandio
=. tym.state (add now ~s40)
;< ~ bind:m (send-wait:strandio tym.state)
(spam-logs 10)
::
++ handle-unix-effect
=/ m (strand ,_state)
^- form:m
@ -353,7 +369,7 @@
1
==
==
(spam-logs 30)
(spam-logs 10)
::
++ cycle-keys
|= who=@p
@ -386,7 +402,7 @@
=. logs.state
%+ weld logs.state
[(broke-continuity:lo who rut) ~]
(spam-logs 30)
(spam-logs 10)
::
++ spam-logs
|= n=@

View File

@ -15,6 +15,8 @@
;< =latest=block bind:m (get-latest-block:ethio url.pup)
;< pup=watchpup bind:m (zoom pup number.id.latest-block)
=| vows=disavows
?. eager.pup
(pure:m !>([vows pup]))
|- ^- form:m
=* loop $
?: (gth number.pup number.id.latest-block)
@ -72,7 +74,7 @@
::
:: Zooming doesn't go forward one block at a time. As a
:: consequence, it cannot detect and handle reorgs. Only use it
:: at a safe distance -- 500 blocks ago is probably sufficient.
:: at a safe distance -- 100 blocks ago is probably sufficient.
::
++ zoom
|= [pup=watchpup =latest=number:block]

View File

@ -14,6 +14,7 @@
%ph-child-sync
%ph-breach-multiple
%ph-breach-sudden
%ph-breach-hi-cousin
%ph-hi-linnup-az
%ph-moon-az
==

View File

@ -1,3 +1,7 @@
:: This is useful to test that we properly hear about breaches outside
:: our sponsorship tree. We usually hear about these via ship-to-ship
:: communication.
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -1,3 +1,5 @@
:: This tests breaches of both parent and child in succession.
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -1,3 +1,7 @@
:: This tests whether we can handle the case where our immediate
:: sponsor dies without telling us about its breach, so we must hear
:: about it from somewhere else.
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -1,3 +1,5 @@
:: This tests that syncs are correctly restarted after a breach
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -205,7 +205,7 @@
::
%+ expect-eq
!> [~[/g/talk] %give %boon [%post 'first1!!']]
!> (snag 1 `(list move:ames)`moves6)
!> (snag 0 `(list move:ames)`moves6)
==
::
++ test-nack ^- tang

View File

@ -50,7 +50,7 @@ _main_readw(const c3_c* str_c, c3_w max_w, c3_w* out_w)
c3_c*
_main_presig(c3_c* txt_c)
{
c3_c* new_c = malloc(2 + strlen(txt_c));
c3_c* new_c = c3_malloc(2 + strlen(txt_c));
if ( '~' == *txt_c ) {
strcpy(new_c, txt_c);
@ -663,15 +663,15 @@ main(c3_i argc,
// allocates more memory as needed if the path is too large
//
while ( abs_c != getcwd(abs_c, mprint_i) ) {
free(abs_c);
c3_free(abs_c);
mprint_i *= 2;
abs_c = c3_malloc(mprint_i);
}
printf("boot: home is %s/%s\n", abs_c, u3_Host.dir_c);
free(abs_c);
c3_free(abs_c);
} else {
printf("boot: home is %s\n", abs_c);
free(abs_c);
c3_free(abs_c);
}
// printf("vere: hostname is %s\n", u3_Host.ops_u.nam_c);

View File

@ -45,6 +45,7 @@
# define c3__basp c3_s4('b','a','s','p')
# define c3__bee c3_s3('b','e','e')
# define c3__bel c3_s3('b','e','l')
# define c3__bbye c3_s4('b','b','y','e')
# define c3__bcbn c3_s4('b','c','b','n')
# define c3__bcbr c3_s4('b','c','b','r')
# define c3__bccb c3_s4('b','c','c','b')

View File

@ -478,6 +478,13 @@
/* u2_utfo: unix terminfo strings.
*/
typedef struct {
struct {
const c3_y* kcuu1_y; // key_up
const c3_y* kcud1_y; // key_down
const c3_y* kcub1_y; // key_back
const c3_y* kcuf1_y; // key_forward
c3_w max_w; // maximum input sequence length
} inn;
struct {
const c3_y* clear_y; // clear_screen
const c3_y* el_y; // clr_bol clear to beginning

View File

@ -1815,7 +1815,7 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_w eus_w, c3_w use_w)
if ( box_u->cod_w ) {
c3_c* cod_c = u3m_pretty(box_u->cod_w);
fprintf(stderr, "code: %s\r\n", cod_c);
free(cod_c);
c3_free(cod_c);
}
u3a_print_memory(stderr, " size", box_u->siz_w);
@ -1823,7 +1823,7 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_w eus_w, c3_w use_w)
{
c3_c* dat_c = _ca_print_box(box_u);
fprintf(stderr, " data: %s\r\n", dat_c);
free(dat_c);
c3_free(dat_c);
}
}
@ -1843,7 +1843,7 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ws use_ws)
{
c3_c* dat_c = _ca_print_box(box_u);
fprintf(stderr, " data: %s\r\n", dat_c);
free(dat_c);
c3_free(dat_c);
}
}

View File

@ -249,12 +249,12 @@ _ce_patch_read_control(u3_ce_patch* pat_u)
len_w = (c3_w) buf_u.st_size;
}
pat_u->con_u = malloc(len_w);
pat_u->con_u = c3_malloc(len_w);
if ( (len_w != read(pat_u->ctl_i, pat_u->con_u, len_w)) ||
(len_w != sizeof(u3e_control) +
(pat_u->con_u->pgs_w * sizeof(u3e_line))) )
{
free(pat_u->con_u);
c3_free(pat_u->con_u);
pat_u->con_u = 0;
return c3n;
}
@ -347,10 +347,10 @@ _ce_patch_verify(u3_ce_patch* pat_u)
static void
_ce_patch_free(u3_ce_patch* pat_u)
{
free(pat_u->con_u);
c3_free(pat_u->con_u);
close(pat_u->ctl_i);
close(pat_u->mem_i);
free(pat_u);
c3_free(pat_u);
}
/* _ce_patch_open(): open patch, if any.
@ -380,7 +380,7 @@ _ce_patch_open(void)
_ce_patch_delete();
return 0;
}
pat_u = malloc(sizeof(u3_ce_patch));
pat_u = c3_malloc(sizeof(u3_ce_patch));
pat_u->ctl_i = ctl_i;
pat_u->mem_i = mem_i;
pat_u->con_u = 0;
@ -388,7 +388,7 @@ _ce_patch_open(void)
if ( c3n == _ce_patch_read_control(pat_u) ) {
close(pat_u->ctl_i);
close(pat_u->mem_i);
free(pat_u);
c3_free(pat_u);
_ce_patch_delete();
return 0;
@ -566,11 +566,11 @@ _ce_patch_compose(void)
return 0;
}
else {
u3_ce_patch* pat_u = malloc(sizeof(u3_ce_patch));
u3_ce_patch* pat_u = c3_malloc(sizeof(u3_ce_patch));
c3_w i_w, pgc_w;
_ce_patch_create(pat_u);
pat_u->con_u = malloc(sizeof(u3e_control) + (pgs_w * sizeof(u3e_line)));
pat_u->con_u = c3_malloc(sizeof(u3e_control) + (pgs_w * sizeof(u3e_line)));
pgc_w = 0;
for ( i_w = 0; i_w < nor_w; i_w++ ) {

View File

@ -65,7 +65,7 @@ u3i_chubs(c3_w a_w,
b_w[(2 * i_w) + 1] = b_d[i_w] >> 32ULL;
}
p = u3i_words((a_w * 2), b_w);
free(b_w);
c3_free(b_w);
return p;
}

View File

@ -414,7 +414,7 @@ _cj_chum(u3_noun chu)
memset(buf, 0, 33);
snprintf(buf, 32, "%s%d", h_chu_c, t_chu);
free(h_chu_c);
c3_free(h_chu_c);
return strdup(buf);
}
}
@ -440,7 +440,7 @@ _cj_je_fsck(u3_noun clu)
q_clu = u3t(u3t(q_clu));
}
if ( !_(u3du(q_clu)) ) {
u3z(clu); free(nam_c); return u3_none;
u3z(clu); c3_free(nam_c); return u3_none;
}
if ( (1 == u3h(q_clu)) && (0 == u3t(q_clu)) ) {
@ -448,7 +448,7 @@ _cj_je_fsck(u3_noun clu)
}
else {
if ( (0 != u3h(q_clu)) || !_(u3a_is_cat(axe_l = u3t(q_clu))) ) {
u3z(clu); free(nam_c); return u3_none;
u3z(clu); c3_free(nam_c); return u3_none;
}
}
@ -462,7 +462,7 @@ _cj_je_fsck(u3_noun clu)
(c3n == u3r_cell(ir_clu, &pir_clu, &qir_clu)) ||
(c3n == u3ud(pir_clu)) )
{
u3z(huk); u3z(clu); free(nam_c); return u3_none;
u3z(huk); u3z(clu); c3_free(nam_c); return u3_none;
}
huk = u3kdb_put(huk, u3k(pir_clu), u3k(qir_clu));
r_clu = tr_clu;
@ -472,7 +472,7 @@ _cj_je_fsck(u3_noun clu)
{
u3_noun pro = u3nt(u3i_string(nam_c), axe_l, huk);
free(nam_c);
c3_free(nam_c);
return pro;
}
}
@ -825,7 +825,7 @@ u3j_boot(c3_o nuu_o)
u3D.len_l =_cj_count(0, u3D.dev_u);
u3D.all_l = (2 * u3D.len_l) + 1024; // horrid heuristic
u3D.ray_u = (u3j_core*) malloc(u3D.all_l * sizeof(u3j_core));
u3D.ray_u = c3_malloc(u3D.all_l * sizeof(u3j_core));
memset(u3D.ray_u, 0, (u3D.all_l * sizeof(u3j_core)));
if ( c3n == nuu_o ) {

View File

@ -417,12 +417,12 @@ u3m_file(c3_c* pas_c)
close(fid_i);
if ( fln_w != red_w ) {
free(pad_y);
c3_free(pad_y);
return u3m_bail(c3__fail);
}
else {
u3_noun pad = u3i_bytes(fln_w, (c3_y *)pad_y);
free(pad_y);
c3_free(pad_y);
return pad;
}
@ -1354,7 +1354,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
}
else {
c3_w len_w = u3r_met(3, som);
c3_c *buf_c = malloc(2 + (2 * len_w) + 1);
c3_c *buf_c = c3_malloc(2 + (2 * len_w) + 1);
c3_w i_w = 0;
c3_w a_w = 0;
@ -1376,7 +1376,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
if ( str_c ) { strcpy(str_c, buf_c); str_c += len_w; }
free(buf_c);
c3_free(buf_c);
return len_w;
}
}
@ -1389,7 +1389,7 @@ c3_c*
u3m_pretty(u3_noun som)
{
c3_w len_w = _cm_in_pretty(som, c3y, 0);
c3_c* pre_c = malloc(len_w + 1);
c3_c* pre_c = c3_malloc(len_w + 1);
_cm_in_pretty(som, c3y, pre_c);
pre_c[len_w] = 0;
@ -1439,7 +1439,7 @@ c3_c*
u3m_pretty_path(u3_noun som)
{
c3_w len_w = _cm_in_pretty_path(som, NULL);
c3_c* pre_c = malloc(len_w + 1);
c3_c* pre_c = c3_malloc(len_w + 1);
_cm_in_pretty_path(som, pre_c);
pre_c[len_w] = 0;
@ -1454,7 +1454,7 @@ u3m_p(const c3_c* cap_c, u3_noun som)
c3_c* pre_c = u3m_pretty(som);
u3l_log("%s: %s\r\n", cap_c, pre_c);
free(pre_c);
c3_free(pre_c);
}
/* u3m_tape(): dump a tape to stdout.

View File

@ -397,7 +397,7 @@ u3t_nock_trace_pop()
start_time,
duration);
free(name);
c3_free(name);
u3_Host.tra_u.con_w++;
}

View File

@ -145,7 +145,7 @@ _cv_nock_poke(u3_noun ovo)
c3_c* tox_c = u3r_string(tox);
u3l_log("poke: %%%s (%x) on %s\r\n", ovi_c, u3r_mug(ovo), tox_c);
free(tox_c); free(ovi_c); u3z(tox);
c3_free(tox_c); c3_free(ovi_c); u3z(tox);
}
#endif
@ -162,7 +162,7 @@ _cv_nock_poke(u3_noun ovo)
} else {
u3l_log(" happy: %s: %d\r\n", ovi_c, u3kb_lent(u3k(u3h(pro))));
}
free(ovi_c);
c3_free(ovi_c);
}
#endif

View File

@ -89,6 +89,9 @@ _test_mug(void)
fprintf(stderr, "fail (i) (4)\r\n");
exit(1);
}
c3_free(str_y);
c3_free(str_w);
}
fprintf(stderr, "test_mug: ok\n");

View File

@ -268,6 +268,7 @@ _test_cells()
printf("*** _test_imprison: fail-4\n");
}
c3_free(output_y);
c3_free(rand_a);
c3_free(rand_b);
}
@ -721,6 +722,7 @@ _test_imprison_complex()
printf("*** u3r_string: in '%s'; out '%s'\n", in_c, out_c);
}
c3_free(out_c);
in_c = "ab";
noun = u3i_string(in_c);
out_c = u3r_string(noun);
@ -729,6 +731,7 @@ _test_imprison_complex()
printf("*** u3r_string: in '%s'; out '%s'\n", in_c, out_c);
}
c3_free(out_c);
in_c = "abcd";
noun = u3i_string(in_c);
out_c = u3r_string(noun);
@ -737,6 +740,7 @@ _test_imprison_complex()
printf("*** u3r_string: in '%s'; out '%s'\n", in_c, out_c);
}
c3_free(out_c);
in_c = "this is a test";
noun = u3i_string(in_c);
out_c = u3r_string(noun);
@ -744,6 +748,8 @@ _test_imprison_complex()
if (0 != strcmp(in_c, out_c)){
printf("*** u3r_string: in '%s'; out '%s'\n", in_c, out_c);
}
c3_free(out_c);
}
// tape
@ -757,6 +763,8 @@ _test_imprison_complex()
printf("*** u3r_tape 1\n");
}
c3_free(out_y);
// tape stores each byte in the string as one atom in the tree
u3_noun lent = u3qb_lent(noun);
if ( (c3_w)lent != strlen(in_c) ){

View File

@ -31,23 +31,14 @@ _ames_alloc(uv_handle_t* had_u,
*buf = uv_buf_init(ptr_v, 2048);
}
/* _ames_free(): contrasting free.
*/
static void
_ames_free(void* ptr_v)
{
// u3l_log("free %p\n", ptr_v);
free(ptr_v);
}
/* _ames_pact_free(): free packet struct.
*/
static void
_ames_pact_free(u3_pact* pac_u)
{
free(pac_u->hun_y);
free(pac_u->dns_c);
free(pac_u);
c3_free(pac_u->hun_y);
c3_free(pac_u->dns_c);
c3_free(pac_u);
}
/* _ames_send_cb(): send callback.
@ -178,7 +169,7 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u,
u3l_log("ames: czar %s: ip %s\n", pac_u->dns_c, nam_c);
free(nam_c); u3z(nam);
c3_free(nam_c); u3z(nam);
}
#endif
@ -189,7 +180,7 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u,
rai_u = rai_u->ai_next;
}
free(adr_u);
c3_free(adr_u);
uv_freeaddrinfo(aif_u);
}
@ -245,7 +236,7 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c)
c3_c* nam_c = u3r_string(nam);
u3l_log("ames: no galaxy domain for %s, no-op\r\n", nam_c);
free(nam_c);
c3_free(nam_c);
u3z(nam);
return;
}
@ -269,7 +260,7 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c)
snprintf(pac_u->dns_c, 256, "%s.%s", nam_c + 1, bos_c);
// u3l_log("czar %s, dns %s\n", nam_c, pac_u->dns_c);
free(nam_c);
c3_free(nam_c);
u3z(nam);
{
@ -372,12 +363,12 @@ _ames_recv_cb(uv_udp_t* wax_u,
// u3l_log("ames: rx %p\r\n", buf_u.base);
if ( 0 == nrd_i ) {
_ames_free(buf_u->base);
c3_free(buf_u->base);
}
// check protocol version in header matches 0
//
else if ( 0 != (0x7 & *((c3_w*)buf_u->base)) ) {
_ames_free(buf_u->base);
c3_free(buf_u->base);
}
else {
{
@ -398,7 +389,7 @@ _ames_recv_cb(uv_udp_t* wax_u,
u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul), mov);
#endif
}
_ames_free(buf_u->base);
c3_free(buf_u->base);
}
}

View File

@ -32,7 +32,7 @@ _cttp_bods_free(u3_hbod* bod_u)
while ( bod_u ) {
u3_hbod* nex_u = bod_u->nex_u;
free(bod_u);
c3_free(bod_u);
bod_u = nex_u;
}
}
@ -102,7 +102,7 @@ _cttp_bods_to_octs(u3_hbod* bod_u)
}
}
cos = u3i_bytes(len_w, buf_y);
free(buf_y);
c3_free(buf_y);
return u3nc(len_w, cos);
}
@ -177,9 +177,9 @@ _cttp_heds_free(u3_hhed* hed_u)
while ( hed_u ) {
u3_hhed* nex_u = hed_u->nex_u;
free(hed_u->nam_c);
free(hed_u->val_c);
free(hed_u);
c3_free(hed_u->nam_c);
c3_free(hed_u->val_c);
c3_free(hed_u);
hed_u = nex_u;
}
}
@ -258,7 +258,7 @@ static void
_cttp_cres_free(u3_cres* res_u)
{
_cttp_bods_free(res_u->bod_u);
free(res_u);
c3_free(res_u);
}
/* _cttp_cres_new(): create a response
@ -521,12 +521,12 @@ _cttp_creq_free(u3_creq* ceq_u)
_cttp_cres_free(ceq_u->res_u);
}
free(ceq_u->hot_c);
free(ceq_u->por_c);
free(ceq_u->met_c);
free(ceq_u->url_c);
free(ceq_u->vec_u);
free(ceq_u);
c3_free(ceq_u->hot_c);
c3_free(ceq_u->por_c);
c3_free(ceq_u->met_c);
c3_free(ceq_u->url_c);
c3_free(ceq_u->vec_u);
c3_free(ceq_u);
}
/* _cttp_creq_new(): create a u3_creq from an +http-request
@ -663,7 +663,7 @@ _cttp_creq_fire(u3_creq* ceq_u)
}
_cttp_creq_fire_body(ceq_u, _cttp_bod_new(len_w, hos_c));
free(hos_c);
c3_free(hos_c);
}
_cttp_creq_fire_heds(ceq_u, ceq_u->hed_u);
@ -844,7 +844,7 @@ _cttp_creq_connect(u3_creq* ceq_u)
c3_c* hot_c = c3_malloc(len_w);
strncpy(hot_c, ceq_u->hot_c, len_w);
free(ceq_u->cli_u->ssl.server_name);
c3_free(ceq_u->cli_u->ssl.server_name);
ceq_u->cli_u->ssl.server_name = hot_c;
}
@ -875,7 +875,7 @@ _cttp_creq_resolve_cb(uv_getaddrinfo_t* adr_u,
_cttp_creq_connect(ceq_u);
}
free(adr_u);
c3_free(adr_u);
uv_freeaddrinfo(aif_u);
}
@ -1023,6 +1023,6 @@ void
u3_cttp_io_exit(void)
{
SSL_CTX_free(u3_Host.ctp_u.tls_u);
free(u3_Host.ctp_u.ctx_u->io_timeout);
free(u3_Host.ctp_u.ctx_u);
c3_free(u3_Host.ctp_u.ctx_u->io_timeout);
c3_free(u3_Host.ctp_u.ctx_u);
}

View File

@ -490,7 +490,13 @@ _daemon_get_atom(c3_c* url_c)
curl_easy_cleanup(curl);
return u3i_bytes(buf_u.len, (const c3_y*)buf_u.base);
{
u3_noun pro = u3i_bytes(buf_u.len, (const c3_y*)buf_u.base);
c3_free(buf_u.base);
return pro;
}
}
/* _get_cmd_output(): Run a shell command and capture its output.
@ -600,7 +606,7 @@ _boothack_key(u3_noun kef)
if ( u3_nul == des ) {
c3_c* kef_c = u3r_string(kef);
u3l_log("dawn: invalid private keys: %s\r\n", kef_c);
free(kef_c);
c3_free(kef_c);
exit(1);
}
@ -631,7 +637,7 @@ _boothack_key(u3_noun kef)
u3_Host.ops_u.who_c, how_c);
u3z(how);
free(how_c);
c3_free(how_c);
exit(1);
}
@ -826,14 +832,26 @@ _daemon_sign_hold(void)
** (as if we were a client process)
*/
void
_boothack_cb(uv_connect_t *conn, int status)
_boothack_cb(uv_connect_t* con_u, c3_i sas_i)
{
u3_mojo *moj_u = conn->data;
u3_mojo *moj_u = con_u->data;
u3_noun dom = u3nc(c3__doom, _boothack_doom());
u3_atom mat = u3ke_jam(dom);
if ( 0 != sas_i ) {
u3l_log("boot: doom failed: %s\r\n", uv_strerror(sas_i));
u3_daemon_bail();
}
else {
u3_noun dom = u3nc(c3__doom, _boothack_doom());
u3_atom mat = u3ke_jam(dom);
u3_newt_write(moj_u, mat, 0);
u3_newt_write(moj_u, mat, 0);
c3_free(con_u);
// XX [moj_u] is leaked, newt.c doesn't give us a callback
// after which we could close and free it ...
//
// uv_close((uv_handle_t*)&moj_u->pyp_u, (uv_close_cb)c3_free);
}
}
/* _daemon_loop_init(): stuff that comes before the event loop
@ -844,13 +862,14 @@ _daemon_loop_init()
_daemon_sign_init();
_daemon_sign_move();
/* boot hack */
// boot hack: send pier %boot command via %doom cmd socket msg
//
{
u3_moor *mor_u = c3_malloc(sizeof(u3_moor));
uv_connect_t *conn = c3_malloc(sizeof(uv_connect_t));
conn->data = mor_u;
u3_moor* mor_u = c3_malloc(sizeof(u3_moor));
uv_connect_t* con_u = c3_malloc(sizeof(uv_connect_t));
con_u->data = mor_u;
uv_pipe_init(u3L, &mor_u->pyp_u, 0);
uv_pipe_connect(conn, &mor_u->pyp_u, u3K.soc_c, _boothack_cb);
uv_pipe_connect(con_u, &mor_u->pyp_u, u3K.soc_c, _boothack_cb);
}
}
@ -973,7 +992,7 @@ u3_daemon_grab(void* vod_p)
fil_u = fopen(man_c, "w");
fprintf(fil_u, "%s\r\n", wen_c);
free(wen_c);
c3_free(wen_c);
u3z(wen);
}
#else

View File

@ -154,6 +154,8 @@ _dawn_get_jam(c3_c* url_c)
u3_noun jammed = u3k(u3t(octs));
u3z(octs);
c3_free(buf_u.base);
return u3ke_cue(jammed);
}
@ -162,7 +164,12 @@ _dawn_get_jam(c3_c* url_c)
static u3_noun
_dawn_eth_rpc(c3_c* url_c, u3_noun oct)
{
return _dawn_buf_to_oct(_dawn_post_json(url_c, _dawn_oct_to_buf(oct)));
uv_buf_t buf_u = _dawn_post_json(url_c, _dawn_oct_to_buf(oct));
u3_noun pro = _dawn_buf_to_oct(buf_u);
c3_free(buf_u.base);
return pro;
}
/* _dawn_fail(): pre-boot validation failed
@ -205,7 +212,7 @@ _dawn_fail(u3_noun who, u3_noun rac, u3_noun sas)
u3m_p("pre-boot error", u3t(sas));
u3z(how);
free(how_c);
c3_free(how_c);
exit(1);
}
@ -440,7 +447,7 @@ u3_dawn_vent(u3_noun seed)
c3_c* who_c = u3r_string(who);
u3l_log("boot: retrieving keys for sponsor %s\r\n", who_c);
u3z(who);
free(who_c);
c3_free(who_c);
}
// retrieve +point:azimuth of pos (sponsor of ship)
@ -519,12 +526,12 @@ _dawn_come(u3_noun stars)
fclose(fil_u);
}
free(key_c);
c3_free(key_c);
u3z(key);
}
#endif
free(who_c);
c3_free(who_c);
u3z(who);
}

View File

@ -41,6 +41,14 @@ static const c3_i TCP_BACKLOG = 16;
//
#define PROXY_DOMAIN "arvo.network"
/* _http_close_cb(): uv_close_cb that just free's handle
*/
static void
_http_close_cb(uv_handle_t* han_u)
{
c3_free(han_u);
}
/* _http_vec_to_meth(): convert h2o_iovec_t to meth
*/
static u3_weak
@ -89,7 +97,7 @@ _cttp_bods_free(u3_hbod* bod_u)
while ( bod_u ) {
u3_hbod* nex_u = bod_u->nex_u;
free(bod_u);
c3_free(bod_u);
bod_u = nex_u;
}
}
@ -178,9 +186,9 @@ _http_heds_free(u3_hhed* hed_u)
while ( hed_u ) {
u3_hhed* nex_u = hed_u->nex_u;
free(hed_u->nam_c);
free(hed_u->val_c);
free(hed_u);
c3_free(hed_u->nam_c);
c3_free(hed_u->val_c);
c3_free(hed_u);
hed_u = nex_u;
}
}
@ -332,7 +340,7 @@ _http_req_done(void* ptr_v)
}
if ( 0 != req_u->tim_u ) {
uv_close((uv_handle_t*)req_u->tim_u, (uv_close_cb)free);
uv_close((uv_handle_t*)req_u->tim_u, _http_close_cb);
req_u->tim_u = 0;
}
@ -791,7 +799,7 @@ _http_conn_free(uv_handle_t* han_t)
_http_serv_free(htp_u);
}
free(hon_u);
c3_free(hon_u);
}
/* _http_conn_new(): create and accept http connection.
@ -896,8 +904,8 @@ _http_h2o_context_dispose(h2o_context_t* ctx)
h2o_context_dispose_pathconf_context(ctx, &hostconf->fallback_path);
}
free(ctx->_pathconfs_inited.entries);
free(ctx->_module_configs);
c3_free(ctx->_pathconfs_inited.entries);
c3_free(ctx->_module_configs);
h2o_timeout_dispose(ctx->loop, &ctx->zero_timeout);
h2o_timeout_dispose(ctx->loop, &ctx->hundred_ms_timeout);
@ -923,7 +931,7 @@ _http_h2o_context_dispose(h2o_context_t* ctx)
}
}
free(ctx->storage.entries);
c3_free(ctx->storage.entries);
h2o_multithread_unregister_receiver(ctx->queue, &ctx->receivers.hostinfo_getaddr);
h2o_multithread_destroy_queue(ctx->queue);
@ -953,12 +961,12 @@ _http_serv_really_free(u3_http* htp_u)
// XX h2o_cleanup_thread if not restarting?
free(htp_u->h2o_u);
c3_free(htp_u->h2o_u);
htp_u->h2o_u = 0;
}
_http_serv_unlink(htp_u);
free(htp_u);
c3_free(htp_u);
}
/* http_serv_free_cb(): timer callback for freeing http server.
@ -974,7 +982,7 @@ http_serv_free_cb(uv_timer_t* tim_u)
_http_serv_really_free(htp_u);
uv_close((uv_handle_t*)tim_u, (uv_close_cb)free);
uv_close((uv_handle_t*)tim_u, _http_close_cb);
}
/* _http_serv_free(): begin to free http server.
@ -1184,8 +1192,8 @@ _http_serv_init_h2o(SSL_CTX* tls_u, c3_o log, c3_o red)
h2o_access_log_register(&h2o_u->hos_u->fallback_path, fil_u);
free(paf_c);
free(now_c);
c3_free(paf_c);
c3_free(now_c);
u3z(now);
#endif
}
@ -1418,7 +1426,7 @@ _http_write_ports_file(c3_c *pax_c)
snprintf(paf_c, len_w, "%s/%s", pax_c, nam_c);
c3_i por_i = open(paf_c, O_WRONLY | O_CREAT | O_TRUNC, 0666);
free(paf_c);
c3_free(paf_c);
u3_http* htp_u = u3_Host.htp_u;
@ -1449,7 +1457,7 @@ _http_release_ports_file(c3_c *pax_c)
snprintf(paf_c, len_w, "%s/%s", pax_c, nam_c);
unlink(paf_c);
free(paf_c);
c3_free(paf_c);
}
/* u3_http_ef_bake(): notify %eyre that we're live
@ -1668,14 +1676,14 @@ _http_form_free(void)
}
if ( 0 != for_u->key_u.base ) {
free(for_u->key_u.base);
c3_free(for_u->key_u.base);
}
if ( 0 != for_u->cer_u.base ) {
free(for_u->cer_u.base);
c3_free(for_u->cer_u.base);
}
free(for_u);
c3_free(for_u);
u3_Host.fig_u.for_u = 0;
}
@ -1834,9 +1842,9 @@ static void
_proxy_warc_free(u3_warc* cli_u)
{
_proxy_warc_unlink(cli_u);
free(cli_u->non_u.base);
free(cli_u->hot_c);
free(cli_u);
c3_free(cli_u->non_u.base);
c3_free(cli_u->hot_c);
c3_free(cli_u);
}
/* _proxy_warc_new(): allocate ship-specific proxy client
@ -1948,7 +1956,7 @@ _proxy_conn_free(uv_handle_t* han_u)
u3_pcon* con_u = han_u->data;
if ( 0 != con_u->buf_u.base ) {
free(con_u->buf_u.base);
c3_free(con_u->buf_u.base);
}
if ( u3_ptyp_ward == con_u->typ_e ) {
@ -1957,7 +1965,7 @@ _proxy_conn_free(uv_handle_t* han_u)
_proxy_conn_unlink(con_u);
free(con_u);
c3_free(con_u);
}
/* _proxy_conn_close(): close both sides of proxy connection
@ -1972,7 +1980,7 @@ _proxy_conn_close(u3_pcon* con_u)
}
if ( 0 != con_u->upt_u ) {
uv_close((uv_handle_t*)con_u->upt_u, (uv_close_cb)free);
uv_close((uv_handle_t*)con_u->upt_u, _http_close_cb);
}
uv_close((uv_handle_t*)&con_u->don_u, _proxy_conn_free);
@ -2048,11 +2056,11 @@ _proxy_write_cb(uv_write_t* wri_u, c3_i sas_i)
if ( 0 != wri_u->data ) {
proxy_write_ctx* ctx_u = wri_u->data;
free(ctx_u->buf_c);
free(ctx_u);
c3_free(ctx_u->buf_c);
c3_free(ctx_u);
}
free(wri_u);
c3_free(wri_u);
}
/* _proxy_write(): write buffer to proxy stream
@ -2157,7 +2165,7 @@ _proxy_loop_connect_cb(uv_connect_t * upc_u, c3_i sas_i)
_proxy_fire(con_u);
}
free(upc_u);
c3_free(upc_u);
}
/* _proxy_loop_connect(): connect to loopback.
@ -2211,7 +2219,7 @@ _proxy_loop_connect(u3_pcon* con_u)
(const struct sockaddr*)&lop_u,
_proxy_loop_connect_cb)) ) {
u3l_log("proxy: connect: %s\n", uv_strerror(sas_i));
free(upc_u);
c3_free(upc_u);
_proxy_conn_close(con_u);
}
}
@ -2257,7 +2265,7 @@ _proxy_wcon_free(uv_handle_t* han_u)
u3_wcon* won_u = han_u->data;
// Note: not unlinked here, freed concurrent with u3_ward
free(won_u);
c3_free(won_u);
}
/* _proxy_wcon_close(): close ward upstream candidate.
@ -2333,8 +2341,8 @@ _proxy_ward_free(uv_handle_t* han_u)
{
u3_ward* rev_u = han_u->data;
free(rev_u->non_u.base);
free(rev_u);
c3_free(rev_u->non_u.base);
c3_free(rev_u);
}
/* _proxy_ward_close_timer(): close ward timer
@ -2553,7 +2561,7 @@ _proxy_ward_start(u3_pcon* con_u, u3_noun sip)
u3_noun who = u3dc("scot", 'p', u3k(sip));
c3_c* who_c = u3r_string(who);
u3l_log("\r\nward for %s started on %u\r\n", who_c, rev_u->por_s);
free(who_c);
c3_free(who_c);
u3z(who);
}
#endif
@ -2592,7 +2600,7 @@ _proxy_ward_connect_cb(uv_connect_t * upc_u, c3_i sas_i)
cli_u->non_u = uv_buf_init(0, 0);
}
free(upc_u);
c3_free(upc_u);
}
/* _proxy_ward_connect(): connect to remote ward
@ -2620,7 +2628,7 @@ _proxy_ward_connect(u3_warc* cli_u)
(const struct sockaddr*)&add_u,
_proxy_ward_connect_cb)) ) {
u3l_log("proxy: ward connect: %s\n", uv_strerror(sas_i));
free(upc_u);
c3_free(upc_u);
_proxy_conn_close(con_u);
}
}
@ -2644,7 +2652,7 @@ _proxy_ward_resolve_cb(uv_getaddrinfo_t* adr_u,
_proxy_ward_connect(cli_u);
}
free(adr_u);
c3_free(adr_u);
uv_freeaddrinfo(aif_u);
}
@ -2673,7 +2681,7 @@ _proxy_ward_resolve(u3_warc* cli_u)
// incremented to skip '~'
snprintf(cli_u->hot_c, len_w, "%s.%s", sip_c + 1, PROXY_DOMAIN);
free(sip_c);
c3_free(sip_c);
u3z(sip);
}
@ -2806,7 +2814,7 @@ _proxy_parse_ship(c3_c* hot_c)
sip_c[1 + dif_w] = 0;
sip = u3dc("slaw", 'p', u3i_string(sip_c));
free(sip_c);
c3_free(sip_c);
return sip;
}
@ -2881,7 +2889,7 @@ _proxy_peek(u3_pcon* con_u)
}
if ( 0 != hot_c ) {
free(hot_c);
c3_free(hot_c);
}
}
@ -2913,7 +2921,7 @@ _proxy_peek_read_cb(uv_stream_t* don_u,
memcpy(ptr_v + con_u->buf_u.len, buf_u->base, siz_w);
con_u->buf_u = uv_buf_init(ptr_v, len_w);
free(buf_u->base);
c3_free(buf_u->base);
}
_proxy_peek(con_u);
@ -2950,7 +2958,7 @@ _proxy_serv_free(u3_prox* lis_u)
// not unlinked here, owned directly by htp_u
free(lis_u);
c3_free(lis_u);
}
/* _proxy_serv_close(): close proxy listener

View File

@ -135,7 +135,7 @@ c3_o _perform_put_on_database_noun(MDB_txn* transaction_u,
// copy the jammed noun into a byte buffer we can hand to lmdb
c3_w len_w = u3r_met(3, mat);
c3_y* bytes_y = (c3_y*) malloc(len_w);
c3_y* bytes_y = c3_malloc(len_w);
u3r_bytes(0, len_w, bytes_y, mat);
c3_o ret = _perform_put_on_database_raw(
@ -145,7 +145,7 @@ c3_o _perform_put_on_database_noun(MDB_txn* transaction_u,
key, strlen(key),
bytes_y, len_w);
free(bytes_y);
c3_free(bytes_y);
u3z(mat);
return ret;
@ -230,11 +230,11 @@ u3_lmdb_build_write_request(u3_writ* event_u, c3_d count)
*/
void u3_lmdb_free_write_request(struct u3_lmdb_write_request* request) {
for (c3_d i = 0; i < request->event_count; ++i)
free(request->malloced_event_data[i]);
c3_free(request->malloced_event_data[i]);
free(request->malloced_event_data);
free(request->malloced_event_data_size);
free(request);
c3_free(request->malloced_event_data);
c3_free(request->malloced_event_data_size);
c3_free(request);
}
/* _write_request_data: callback struct for u3_lmdb_write_event()
@ -344,8 +344,8 @@ static void _u3_lmdb_write_event_after_cb(uv_work_t* req, int status) {
data->request->event_count);
u3_lmdb_free_write_request(data->request);
free(data);
free(req);
c3_free(data);
c3_free(req);
}
/* u3_lmdb_write_event(): Asynchronously writes events to the database.

View File

@ -312,8 +312,8 @@ _newt_write_cb(uv_write_t* wri_u, c3_i sas_i)
void* vod_p = req_u->vod_p;
u3_mojo* moj_u = req_u->moj_u;
free(req_u->buf_y);
free(req_u);
c3_free(req_u->buf_y);
c3_free(req_u);
if ( 0 != sas_i ) {
u3l_log("newt: bad write %d\r\n", sas_i);

View File

@ -803,7 +803,7 @@ _pier_work_stdr(u3_writ* wit_u, u3_noun cord)
{
c3_c* str = u3r_string(cord);
u3C.stderr_log_f(str);
free(str);
c3_free(str);
}
/* _pier_work_slog(): print directly.
@ -1041,14 +1041,11 @@ _pier_work_create(u3_pier* pir_u)
{
c3_c* arg_c[5];
c3_c* bin_c = u3_Host.wrk_c;
c3_c* pax_c;
c3_c* pax_c = pir_u->pax_c;
c3_c key_c[256];
c3_c wag_c[11];
c3_i err_i;
pax_c = c3_malloc(1 + strlen(pir_u->pax_c));
strcpy(pax_c, pir_u->pax_c);
sprintf(key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64 "",
pir_u->key_d[0],
pir_u->key_d[1],
@ -1341,7 +1338,7 @@ _pier_boot_dispose(u3_boot* bot_u)
u3z(bot_u->pil);
u3z(bot_u->ven);
free(bot_u);
c3_free(bot_u);
pir_u->bot_u = 0;
}

View File

@ -67,7 +67,7 @@ _reck_orchid(u3_noun fot, u3_noun txt, c3_l* tid_l)
{
c3_c* str = u3r_string(txt);
c3_d ato_d = strtol(str, NULL, 10);
free(str);
c3_free(str);
if ( ato_d >= 0x80000000ULL ) {
return c3n;
@ -90,6 +90,11 @@ _reck_kick_term(u3_pier* pir_u, u3_noun pox, c3_l tid_l, u3_noun fav)
}
else switch ( u3h(fav) ) {
default: u3z(pox); u3z(fav); return c3n;
case c3__bbye:
{
u3z(pox); u3z(fav); return c3y;
} break;
case c3__blit: p_fav = u3t(fav);
{
u3_term_ef_blit(tid_l, u3k(p_fav));
@ -97,6 +102,17 @@ _reck_kick_term(u3_pier* pir_u, u3_noun pox, c3_l tid_l, u3_noun fav)
u3z(pox); u3z(fav); return c3y;
} break;
// this can return through dill due to our fscked up boot sequence
//
case c3__send: {
u3_noun lan = u3k(u3h(u3t(fav)));
u3_noun pac = u3k(u3t(u3t(fav)));
u3l_log("kick: strange send\r\n");
u3_ames_ef_send(pir_u, lan, pac);
u3z(pox); u3z(fav); return c3y;
} break;
case c3__logo:
{
u3_pier_exit(pir_u);

View File

@ -58,6 +58,40 @@ _term_alloc(uv_handle_t* had_u,
*buf = uv_buf_init(ptr_v, 123);
}
// XX unused, but %hook is in %zuse.
// implement or remove
//
#if 0
/* _term_close_cb(): free terminal.
*/
static void
_term_close_cb(uv_handle_t* han_t)
{
u3_utty* tty_u = (void*) han_t;
if ( u3_Host.uty_u == tty_u ) {
u3_Host.uty_u = tty_u->nex_u;
}
else {
u3_utty* uty_u;
for (uty_u = u3_Host.uty_u; uty_u; uty_u = uty_u->nex_u ) {
if ( uty_u->nex_u == tty_u ) {
uty_u->nex_u = tty_u->nex_u;
break;
}
}
}
{
u3_noun tid = u3dc("scot", c3__ud, tty_u->tid_l);
u3_noun pax = u3nq(u3_blip, c3__term, tid, u3_nul);
u3_pier_plan(u3k(pax), u3nc(c3__hook, u3_nul));
u3z(pax);
}
c3_free(tty_u);
}
#endif
/* u3_term_io_init(): initialize terminal.
*/
void
@ -101,6 +135,13 @@ u3_term_io_init()
c3_assert(uty_u->ufo_u.way.nam##_y); \
}
uty_u->ufo_u.inn.max_w = 0;
_utfo(inn, kcuu1);
_utfo(inn, kcud1);
_utfo(inn, kcub1);
_utfo(inn, kcuf1);
_utfo(out, clear);
_utfo(out, el);
// _utfo(out, el1);
@ -112,6 +153,38 @@ u3_term_io_init()
_utfo(out, cud1);
// _utfo(out, cub);
// _utfo(out, cuf);
// Terminfo chronically reports the wrong sequence for arrow
// keys on xterms. Drastic fix for ridiculous unacceptable bug.
// Yes, we could fix this with smkx/rmkx, but this is retarded as well.
{
uty_u->ufo_u.inn.kcuu1_y = (const c3_y*)"\033[A";
uty_u->ufo_u.inn.kcud1_y = (const c3_y*)"\033[B";
uty_u->ufo_u.inn.kcuf1_y = (const c3_y*)"\033[C";
uty_u->ufo_u.inn.kcub1_y = (const c3_y*)"\033[D";
}
uty_u->ufo_u.inn.max_w = 0;
if ( (len_w = strlen((c3_c*)uty_u->ufo_u.inn.kcuu1_y)) >
uty_u->ufo_u.inn.max_w )
{
uty_u->ufo_u.inn.max_w = len_w;
}
if ( (len_w = strlen((c3_c*)uty_u->ufo_u.inn.kcud1_y)) >
uty_u->ufo_u.inn.max_w )
{
uty_u->ufo_u.inn.max_w = len_w;
}
if ( (len_w = strlen((c3_c*)uty_u->ufo_u.inn.kcub1_y)) >
uty_u->ufo_u.inn.max_w )
{
uty_u->ufo_u.inn.max_w = len_w;
}
if ( (len_w = strlen((c3_c*)uty_u->ufo_u.inn.kcuf1_y)) >
uty_u->ufo_u.inn.max_w )
{
uty_u->ufo_u.inn.max_w = len_w;
}
}
// Load old terminal state to restore.
@ -252,8 +325,8 @@ _term_write_cb(uv_write_t* wri_u, c3_i sas_i)
u3l_log("term: write: %s\n", uv_strerror(sas_i));
}
free(wri_u->data);
free(wri_u);
c3_free(wri_u->data);
c3_free(wri_u);
}
/* _term_it_write_buf(): write buffer uv style.
@ -290,7 +363,7 @@ _term_it_write_old(u3_utty* uty_u,
memcpy(buf_y, old_u->hun_y, old_u->len_w);
buf_u = uv_buf_init((c3_c*)buf_y, old_u->len_w);
free(old_u);
c3_free(old_u);
}
_term_it_write_buf(uty_u, buf_u);
}
@ -333,7 +406,7 @@ _term_it_show_wide(u3_utty* uty_u, c3_w len_w, c3_w* txt_w)
c3_c* txt_c = u3r_string(txt);
_term_it_write_str(uty_u, txt_c);
free(txt_c);
c3_free(txt_c);
u3z(txt);
uty_u->tat_u.mir.cus_w += len_w;
@ -392,7 +465,7 @@ _term_it_show_line(u3_utty* uty_u, c3_w* lin_w, c3_w len_w)
if ( lin_w != uty_u->tat_u.mir.lin_w ) {
if ( uty_u->tat_u.mir.lin_w ) {
free(uty_u->tat_u.mir.lin_w);
c3_free(uty_u->tat_u.mir.lin_w);
}
uty_u->tat_u.mir.lin_w = lin_w;
}
@ -496,8 +569,8 @@ _term_it_save(u3_noun pax, u3_noun pad)
u3_walk_save(pax_c, 0, pad, bas_c, xap);
free(pax_c);
free(bas_c);
c3_free(pax_c);
c3_free(bas_c);
}
/* _term_io_belt(): send belt.
@ -505,8 +578,6 @@ _term_it_save(u3_noun pax, u3_noun pad)
static void
_term_io_belt(u3_utty* uty_u, u3_noun blb)
{
// Here, we use scot just to build out the plan.
//
u3_noun tid = u3dc("scot", c3__ud, uty_u->tid_l);
u3_noun pax = u3nq(u3_blip, c3__term, tid, u3_nul);
@ -660,7 +731,7 @@ _term_read_cb(uv_stream_t* tcp_u,
{
u3_utty* uty_u = (u3_utty*)(void*)tcp_u;
_term_suck(uty_u, (const c3_y*)buf_u->base, siz_i);
free(buf_u->base);
c3_free(buf_u->base);
}
/* _term_spin_write_str(): write null-terminated string
@ -764,7 +835,7 @@ u3_term_start_spinner(c3_c* why_c, c3_o now_o)
u3_utty* uty_u = _term_main();
u3_utat* tat_u = &uty_u->tat_u;
free(tat_u-> sun_u.why_c);
c3_free(tat_u-> sun_u.why_c);
tat_u->sun_u.why_c = why_c;
tat_u->sun_u.eve_d = 0;
@ -987,7 +1058,7 @@ _term_ef_blit(u3_utty* uty_u,
_term_it_show_clear(uty_u);
_term_it_write_str(uty_u, txt_c);
free(txt_c);
c3_free(txt_c);
_term_it_show_more(uty_u);
_term_it_refresh_line(uty_u);

View File

@ -195,7 +195,7 @@ _unix_write_file_hard(c3_c* pax_c, u3_noun mim)
}
close(fid_i);
free(dat_y);
c3_free(dat_y);
return mug_w;
}
@ -242,7 +242,7 @@ _unix_write_file_soft(u3_ufil* fil_u, u3_noun mim)
u3l_log("wrong # of bytes read in file %s: %d %d\r\n",
fil_u->pax_c, len_ws, red_ws);
}
free(old_y);
c3_free(old_y);
u3z(mim);
return;
}
@ -251,12 +251,12 @@ _unix_write_file_soft(u3_ufil* fil_u, u3_noun mim)
if ( old_w != fil_u->gum_w ) {
fil_u->gum_w = u3r_mug(u3t(u3t(mim))); // XXX this might fail with
free(old_y); // trailing zeros
c3_free(old_y); // trailing zeros
u3z(mim);
return;
}
free(old_y);
c3_free(old_y);
_unix_write_file_soft_go:
fil_u->gum_w = _unix_write_file_hard(fil_u->pax_c, mim);
@ -301,7 +301,7 @@ _unix_get_mount_point(u3_pier *pir_u, u3_noun mon)
}
else {
free(nam_c);
c3_free(nam_c);
}
u3z(mon);
@ -351,12 +351,12 @@ _unix_scan_mount_point(u3_pier *pir_u, u3_umon* mon_u)
if ( 0 != stat(pax_c, &buf_u) ) {
u3l_log("can't stat pier directory %s: %s\r\n",
mon_u->dir_u.pax_c, strerror(errno));
free(pax_c);
c3_free(pax_c);
continue;
}
if ( S_ISDIR(buf_u.st_mode) ) {
if ( out_u->d_name[len_w] != '\0' ) {
free(pax_c);
c3_free(pax_c);
continue;
}
else {
@ -371,7 +371,7 @@ _unix_scan_mount_point(u3_pier *pir_u, u3_umon* mon_u)
|| ('#' == out_u->d_name[0] &&
'#' == out_u->d_name[strlen(out_u->d_name) - 1])
) {
free(pax_c);
c3_free(pax_c);
continue;
}
else {
@ -380,7 +380,7 @@ _unix_scan_mount_point(u3_pier *pir_u, u3_umon* mon_u)
}
}
free(pax_c);
c3_free(pax_c);
}
}
}
@ -397,8 +397,8 @@ _unix_free_file(u3_ufil *fil_u)
c3_assert(0);
}
free(fil_u->pax_c);
free(fil_u);
c3_free(fil_u->pax_c);
c3_free(fil_u);
}
/* _unix_free_dir(): free directory, deleting everything within
@ -414,8 +414,8 @@ _unix_free_dir(u3_udir *dir_u)
else {
// fprintf(stderr, "i'm a lone, lonely loner %s\r\n", dir_u->pax_c);
}
free(dir_u->pax_c);
free(dir_u); // XXX this might be too early, how do we
c3_free(dir_u->pax_c);
c3_free(dir_u); // XXX this might be too early, how do we
// know we've freed all the children?
// i suspect we should do this only if
// our kid list is empty
@ -483,9 +483,9 @@ _unix_free_mount_point(u3_pier *pir_u, u3_umon* mon_u)
nod_u = nex_u;
}
free(mon_u->dir_u.pax_c);
free(mon_u->nam_c);
free(mon_u);
c3_free(mon_u->dir_u.pax_c);
c3_free(mon_u->nam_c);
c3_free(mon_u);
}
/* _unix_delete_mount_point(): remove mount point from list and free
@ -530,7 +530,7 @@ _unix_delete_mount_point(u3_pier *pir_u, u3_noun mon)
_unix_free_mount_point(pir_u, tem_u);
_delete_mount_point_out:
free(nam_c);
c3_free(nam_c);
u3z(mon);
}
@ -603,7 +603,7 @@ _unix_create_dir(u3_udir* dir_u, u3_udir* par_u, u3_noun nam)
strncpy(pax_c + pax_w + 1, nam_c, nam_w);
pax_c[pax_w + 1 + nam_w] = '\0';
free(nam_c);
c3_free(nam_c);
u3z(nam);
_unix_mkdir(pax_c);
@ -666,18 +666,18 @@ _unix_update_file(u3_pier *pir_u, u3_ufil* fil_u)
u3l_log("wrong # of bytes read in file %s: %d %d\r\n",
fil_u->pax_c, len_ws, red_ws);
}
free(dat_y);
c3_free(dat_y);
return u3_nul;
}
else {
c3_w mug_w = u3r_mug_bytes(dat_y, len_ws);
if ( mug_w == fil_u->mug_w ) {
free(dat_y);
c3_free(dat_y);
return u3_nul;
}
else if ( mug_w == fil_u->gum_w ) {
fil_u->mug_w = mug_w;
free(dat_y);
c3_free(dat_y);
return u3_nul;
}
else {
@ -687,7 +687,7 @@ _unix_update_file(u3_pier *pir_u, u3_ufil* fil_u)
u3_noun mim = u3nt(c3__text, u3i_string("plain"), u3_nul);
u3_noun dat = u3nt(mim, len_ws, u3i_bytes(len_ws, dat_y));
free(dat_y);
c3_free(dat_y);
return u3nc(u3nt(pax, u3_nul, dat), u3_nul);
}
}
@ -793,7 +793,7 @@ _unix_update_dir(u3_pier *pir_u, u3_udir* dir_u)
if ( 0 != stat(pax_c, &buf_u) ) {
u3l_log("can't stat %s: %s\r\n", pax_c, strerror(errno));
free(pax_c);
c3_free(pax_c);
continue;
}
else {
@ -823,7 +823,7 @@ _unix_update_dir(u3_pier *pir_u, u3_udir* dir_u)
|| ('#' == out_u->d_name[0] &&
'#' == out_u->d_name[strlen(out_u->d_name) - 1])
) {
free(pax_c);
c3_free(pax_c);
continue;
}
@ -838,7 +838,7 @@ _unix_update_dir(u3_pier *pir_u, u3_udir* dir_u)
}
}
free(pax_c);
c3_free(pax_c);
}
}
@ -932,7 +932,7 @@ _unix_initial_update_file(c3_c* pax_c, c3_c* bas_c)
u3l_log("wrong # of bytes read in initial file %s: %d %d\r\n",
pax_c, len_ws, red_ws);
}
free(dat_y);
c3_free(dat_y);
return u3_nul;
}
else {
@ -942,7 +942,7 @@ _unix_initial_update_file(c3_c* pax_c, c3_c* bas_c)
u3_noun mim = u3nt(c3__text, u3i_string("plain"), u3_nul);
u3_noun dat = u3nt(mim, len_ws, u3i_bytes(len_ws, dat_y));
free(dat_y);
c3_free(dat_y);
return u3nc(u3nt(pax, u3_nul, dat), u3_nul);
}
}
@ -987,7 +987,7 @@ _unix_initial_update_dir(c3_c* pax_c, c3_c* bas_c)
if ( 0 != stat(pox_c, &buf_u) ) {
u3l_log("initial can't stat %s: %s\r\n",
pox_c, strerror(errno));
free(pox_c);
c3_free(pox_c);
continue;
}
else {
@ -997,7 +997,7 @@ _unix_initial_update_dir(c3_c* pax_c, c3_c* bas_c)
else {
can = u3kb_weld(_unix_initial_update_file(pox_c, bas_c), can);
}
free(pox_c);
c3_free(pox_c);
}
}
}
@ -1045,7 +1045,7 @@ _unix_sync_file(u3_pier *pir_u, u3_udir* par_u, u3_noun nam, u3_noun ext, u3_nou
strncpy(pax_c + par_w + 1 + nam_w + 1, ext_c, ext_w);
pax_c[par_w + 1 + nam_w + 1 + ext_w] = '\0';
free(nam_c); free(ext_c);
c3_free(nam_c); c3_free(ext_c);
u3z(nam); u3z(ext);
// check whether we already know about this file
@ -1079,7 +1079,7 @@ _unix_sync_file(u3_pier *pir_u, u3_udir* par_u, u3_noun nam, u3_noun ext, u3_nou
}
}
free(pax_c);
c3_free(pax_c);
_unix_sync_file_out:
u3z(mim);
@ -1261,7 +1261,7 @@ u3_unix_acquire(c3_c* pax_c)
}
fclose(loq_u);
free(paf_c);
c3_free(paf_c);
}
/* u3_unix_release(): release a lockfile.
@ -1272,7 +1272,7 @@ u3_unix_release(c3_c* pax_c)
c3_c* paf_c = _unix_down(pax_c, ".vere.lock");
unlink(paf_c);
free(paf_c);
c3_free(paf_c);
}
/* u3_unix_ef_bake(): initial effects for new process.

View File

@ -57,12 +57,12 @@ u3_walk_safe(c3_c* pas_c)
close(fid_i);
if ( fln_w != red_w ) {
free(pad_y);
c3_free(pad_y);
return 0;
}
else {
u3_noun pad = u3i_bytes(fln_w, (c3_y *)pad_y);
free(pad_y);
c3_free(pad_y);
return pad;
}
@ -89,12 +89,12 @@ u3_walk_load(c3_c* pas_c)
close(fid_i);
if ( fln_w != red_w ) {
free(pad_y);
c3_free(pad_y);
return u3m_bail(c3__fail);
}
else {
u3_noun pad = u3i_bytes(fln_w, (c3_y *)pad_y);
free(pad_y);
c3_free(pad_y);
return pad;
}
@ -130,7 +130,7 @@ _walk_mkdirp(c3_c* bas_c, u3_noun pax)
}
_walk_mkdirp(pax_c, u3t(pax));
free(pax_c);
c3_free(pax_c);
}
/* u3_walk_save(): save file or bail.
@ -160,7 +160,7 @@ u3_walk_save(c3_c* pas_c, u3_noun tim, u3_atom pad, c3_c* bas_c, u3_noun pax)
rit_w = write(fid_i, pad_y, fln_w);
close(fid_i);
free(pad_y);
c3_free(pad_y);
if ( rit_w != fln_w ) {
u3l_log("%s: %s\n", pas_c, strerror(errno));
@ -218,7 +218,7 @@ _walk_in(const c3_c* dir_c, c3_w len_w)
pat_c[lef_w] = '\0';
if ( 0 != stat(pat_c, &buf_b) ) {
free(pat_c);
c3_free(pat_c);
} else {
u3_noun tim = c3_stat_mtime(&buf_b);
@ -244,8 +244,8 @@ _walk_in(const c3_c* dir_c, c3_w len_w)
get = u3kdb_put(get, ext, u3nt(c3y, hax, dat));
map = u3kdb_put(map, nam, u3nc(c3n, get));
}
free(nam_c);
free(ext_c);
c3_free(nam_c);
c3_free(ext_c);
}
else {
u3_noun dir = _walk_in(pat_c, lef_w);
@ -256,7 +256,7 @@ _walk_in(const c3_c* dir_c, c3_w len_w)
}
else u3z(tim);
}
free(pat_c);
c3_free(pat_c);
}
}
}

View File

@ -169,7 +169,7 @@ _worker_prof(FILE* fil_u, c3_w den, u3_noun mas)
{
c3_c* lab_c = u3m_pretty(h_mas);
fprintf(fil_u, "h_mas: %s", lab_c);
free(lab_c);
c3_free(lab_c);
}
return tot_w;
}
@ -179,7 +179,7 @@ _worker_prof(FILE* fil_u, c3_w den, u3_noun mas)
{
c3_c* lab_c = u3m_pretty(h_mas);
fprintf(fil_u, "%s: ", lab_c);
free(lab_c);
c3_free(lab_c);
}
u3_noun it_mas, tt_mas;
@ -277,7 +277,7 @@ _worker_grab(u3_noun sac, u3_noun ovo, u3_noun vir)
fil_u = fopen(man_c, "w");
fprintf(fil_u, "%s\r\n", wen_c);
free(wen_c);
c3_free(wen_c);
u3z(wen);
}
#else
@ -668,7 +668,7 @@ _worker_work_live(c3_d evt_d, u3_noun job)
clr_w, txt_c, evt_d, ms_w,
(int) (d0.tv_usec % 1000) / 10);
}
free(txt_c);
c3_free(txt_c);
}
#endif
@ -796,9 +796,17 @@ _worker_poke_work(c3_d evt_d, // event number
u3_noun wir = u3h(u3t(job));
u3_noun cad = u3h(u3t(u3t(job)));
// XX these allocations should only be performed if tracing is enabled
//
c3_c lab_c[2048];
snprintf(lab_c, 2048, "event %" PRIu64 ": [%s %s]", evt_d,
u3m_pretty_path(wir), u3m_pretty(cad));
{
c3_c* cad_c = u3m_pretty(cad);
c3_c* wir_c = u3m_pretty_path(wir);
snprintf(lab_c, 2048, "event %" PRIu64 ": [%s %s]",
evt_d, wir_c, cad_c);
c3_free(cad_c);
c3_free(wir_c);
}
u3t_event_trace(lab_c, 'B');
_worker_work_live(evt_d, job);
@ -831,7 +839,7 @@ _worker_poke_exit(c3_w cod_w) // exit code
fil_u = fopen(man_c, "w");
free(wen_c);
c3_free(wen_c);
u3z(wen);
}