parsav  Diff

Differences From Artifact [99b348e685]:

To Artifact [745afb2f25]:


    13     13   	
    14     14   	if notes.ct == 0 then
    15     15   		co:complain(200,'no news is good news',"you don't have any notices to review")
    16     16   		return
    17     17   	end
    18     18   	defer notes:free()
    19     19   
    20         -	var pg: lib.str.acc pg:init(512) defer pg:free()
    21         -	var pflink: lib.str.acc pflink:init(64)
    22         -	var body: lib.str.acc body:init(256)
           20  +	var pg = co:stra(512) -- defer pg:free()
           21  +	var pflink = co:stra(64)
           22  +	var body = co:stra(256)
    23     23   	var latest: lib.store.timepoint = 0
    24     24   	for i=0,notes.ct do
    25     25   		if notes(i).when > latest then latest = notes(i).when end
    26     26   		var who = co.srv:actor_fetch_uid(notes(i).who) defer who:free()
    27     27   		if not who then lib.bail('schema integrity violation: nonexistent actor referenced in notification, this is almost certainly an SQL error or bug in the backend implementation') end
    28     28   		pflink:cue(lib.str.sz(who(0).xid) + 4)
    29     29   		if who(0).origin == 0 then pflink:lpush('/')
................................................................................
    49     49   				n.kind = P'reply'
    50     50   				n.act = P'replied to your post'
    51     51   				notweet = false
    52     52   			end
    53     53   		else goto skip end
    54     54   		do var idbuf: int8[lib.math.shorthand.maxlen]
    55     55   			var idlen = lib.math.shorthand.gen(notes(i).what, idbuf)
    56         -			var b = lib.smackdown.html(pstr {ptr=what(0).body,ct=0},true) defer b:free()
           56  +			var b = lib.smackdown.html(&co.srv.pool, pstr {ptr=what(0).body,ct=0},true) --defer b:free()
    57     57   			body:lpush(' <a class="quote" href="/post/'):push(&idbuf[0],idlen):lpush('">'):ppush(b):lpush('</a>')
    58     58   		end
    59     59   		if not notweet then
    60     60   			var reply = co.srv:post_fetch(notes(i).reply)
    61     61   				lib.render.tweet(co,reply.ptr,&body)
    62     62   			reply:free()
    63     63   		end
................................................................................
    64     64   		n.ref = pstr {ptr = body.buf, ct = body.sz}
    65     65   
    66     66   		n:append(&pg)
    67     67   		::skip:: n.nym:free()
    68     68   		         pflink:reset()
    69     69   				 body:reset()
    70     70   	end
    71         -	pflink:free()
           71  +	--pflink:free()
    72     72   	pg:lpush('<form method="post"><button name="act" value="clear">clear all notices</button></form>')
    73     73   	co:livepage([lib.srv.convo.page] {
    74     74   		title = P'notices', class = P'notices';
    75     75   		body = pstr {ptr = pg.buf, ct = pg.sz};
    76     76   		cache = false;
    77     77   	}, latest)
    78     78   end
    79     79   
    80     80   return render_notices